tweetysat
tweetysat

Reputation: 2403

Spring Cloud Stream - Send and receive synchronized

In my spring boot rest controller, I'm using StreamBridge for sending a message to the rabbitMQ server with something like

streamBridge.send("consumer-in-0", "hello world");

Is there a way to do a send and wait the response ?

Upvotes: 3

Views: 1118

Answers (2)

Santanu
Santanu

Reputation: 937

There is one more option -

streamBridge.setAsync(false)

And to check

streamBridge.isAsync()

Upvotes: 0

WiredCoder
WiredCoder

Reputation: 926

Alright, as I said, late to the party, but there seems to be a way. simply you can make the producer synchronous, this can be done in application.properties as such:

spring.cloud.stream.kafka.bindings.functionName-out-0.producer.sync=true

The same configuration was originally working for the MessageChannel pre Spring cloud function, but as I understand the underlying functionality is already the same

Upvotes: 1

Related Questions