2

If you send messages to an Azure Service bus topic/queue using SendAsync(...) is the message ordering guaranteed?

For example if I had an application with one thread that was sending lots of messages using SendAsync, would the order in which the method SendAsync was called be maintained? Is the Service Bus client library smart enough to know that although the messages will be sent asynchronously, that the order in which they are added to the topic is maintained throughout?

4

2 回答 2

1

异步与否,尝试从消息总线中提取排序保证有点滑坡。您受制于始终不可靠的网络。

请注意,Azure 服务总线默认不提供任何排序​​保证。您可以通过消息会话引入一些先进先出的顺序,但这不足以保证您的消息将被处理的顺序。这里有一篇很好的文章总结了消息排序的困难:

http://blog.jayway.com/2013/12/20/message-ordering-on-windows-azure-service-bus-queues/

一般来说,我尝试设计消息,以便排序无关紧要。如果不这样做,我建议将序列号添加到消息消费者可以解释的消息中。

于 2015-01-24T17:10:28.230 回答
0

这不是没有按顺序发生的发送。很可能是收到的。如果主题是分区的(现在是默认设置),我们将在多台机器上分片消息。

于 2016-12-29T22:44:48.217 回答