简体   繁体   中英

Using Spring Cloud Streaming, how to send messages to binder synchronously?

I'm building a cloud stream application using Spring with Azure Event Hub and Service bus. In my use case I'm trying to achieve the following functionality:

  1. Application that receives messages from a single binder (event hub)
  2. Process the messages in a few steps, step A, B, C for example
  3. Each step in the process creates objects
  4. Stream the objects which were created in each step to different binders. If sending messages failed in any step, don't proceed

The question is, does the message sending is sync or async? Will it wait until all messages sent in step A before executing the next steps?

To make sure the message production happens synchronously you can simply set the spring.cloud.stream.eventhub.bindings.<channel-name>.producer.sync property to true .

The related documentation can be found here .

You can see the property referenced in the code here and here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM