简体   繁体   English

使用 Spring Cloud Streaming,如何将消息同步发送到 binder?

[英]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.我正在使用 Spring 和 Azure 事件中心和服务总线构建云 ZF7B44CFFAFD5C52223D5498196C8A2E7BZ 应用程序。 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分几步处理消息,例如步骤 A、B、C
  3. Each step in the process creates objects流程中的每一步都会创建对象
  4. Stream the objects which were created in each step to different binders. Stream 在每个步骤中创建的对象到不同的活页夹。 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?它会等到步骤 A 中发送的所有消息之后再执行后续步骤吗?

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 .为了确保消息生产同步发生,您只需将spring.cloud.stream.eventhub.bindings.<channel-name>.producer.sync属性设置为true

The related documentation can be found here .相关文档可以在这里找到。

You can see the property referenced in the code here and here .您可以在此处此处查看代码中引用的属性。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 spring 云 stream binder kafka 流依赖项使用协议缓冲区(protobuf)来使用来自 kafka 主题的消息? - How to consume messages from kafka topics using protocol buffers (protobuf) by spring cloud stream binder kafka streams dependency? 如何在 spring-cloud-stream-binder-kinesis 中使用 STSAssumeRoleSessionCredentialsProvider 进行配置 - How to Configure using STSAssumeRoleSessionCredentialsProvider in spring-cloud-stream-binder-kinesis 使用 Spring Cloud Stream Kafka Binder 批量消费 Kafka 消息及其密钥 - Consuming Kafka messages with its key in batches using Spring Cloud Stream Kafka Binder 如何在不弃用 class Checkpointer 的情况下使用 azure-spring-cloud-stream-binder-servicebus-queue 接受消息 - How to use azure-spring-cloud-stream-binder-servicebus-queue to accept messages without deprecated class Checkpointer 将 StateRestoreListener 与 Spring Cloud Kafka Streams 绑定器一起使用 - Using StateRestoreListener with Spring Cloud Kafka Streams binder 使用 spring 云 stream 兔子 mq binder 在 header 中发送消息 TTL - Send message TTL in header using spring cloud stream rabbit mq binder 如何使用 spring-cloud-stream-binder-kafka-streams:3.1.1 中的功能方法检索/设置 header - How to retrieve/set header using functional approach in spring-cloud-stream-binder-kafka-streams:3.1.1 如何处理 Spring 云 stream kafka 流活页夹中的序列化错误? - How to handle Serialization error in Spring cloud stream kafka streams binder? Spring Cloud Stream不使用Kafka频道绑定器发送消息 - Spring Cloud Stream doesn't use Kafka channel binder to send a message 如何配置 DeadLetterPublisherRecoverer 以在 Spring Cloud Stream 批处理模式下将错误消息发送到 DLQ - How to configure DeadLetterPublisherRecoverer to send error messages to a DLQ in Spring Cloud Stream batch mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM