Message order of delivery

From RabbitMQ - Message order of delivery

Section 4.7 of the AMQP 0-9-1 core specification explains the conditions under which ordering is guaranteed: messages published in one channel, passing through one exchange and one queue and one outgoing channel will be received in the same order that they were sent. RabbitMQ offers stronger guarantees since release 2.7.0.

Does this hold with EasyNetQ? I would have expected it to hold, but I'm sometimes (but not always) seeing a different behaviour.

If the consumer is synchronized (not my case yet; I have locking but it begins after an "if" which is always false in this case), should I trust messages to be consumed in the order they are published? (Same type of message, same origin, going to same destination) Or are there other elements at play here internal to EasyNetQ which I should be aware of which don't preserve the message order of delivery?


EasyNetQ implements a single consumer thread per IBus instance, so if you use the standard non-async subscribe method your message handler will fire synchronously in the same order that messages are delivered by RabbitMQ. There shouldn't be any need to implement a lock. If you use the async subscribe, the handlers will still be called in order, but of course they may ACK out of order depending on how you implement your async handler.

链接地址: http://www.djcxy.com/p/5842.html

上一篇: 微服务架构中的最佳实践队列/主题设计

下一篇: 消息传送顺序