开发者

RabbitMQ pop operation atomicity

Does anyone know if the pop operation on a RabbitMQ queue is atomic?

I have several processes reading from the same que开发者_如何学Pythonue (the queue is marked as durable, running on version 2.0.0) and I am seeing some quite odd behaviour.


If your multiple processes are consuming messages from the same queue then they should never consume the same message.

Here are the caveats, though:

  1. If a message has been delivered by the broker to one of your consumers and it rejects the message (or terminates before getting a chance to acknowledge it) then the broker will put it back on the same queue and it would be delivered to one of your remaining active consumers.

  2. If your consumers are pulling from distinct queues -- each with a matching binding -- then the broker will put copies of the message on each queue and each consumer will get a copy of the same message.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜