[rabbitmq-discuss] Data is feteched from the queue in random order

Matthias Radestock matthias at rabbitmq.com
Thu Apr 21 12:25:13 BST 2011


On 20/04/11 10:30, Kamal wrote:
> I am trying to dequeue data from the RabbitMQ. Why is it so that the
> data is not dequeued in the same order in which it was enqueued into
> the queue?

See section 4.7 for the AMQP 0-9-1 spec for the ordering guarantees provided

contents flowing through a single path within the server will remain 
ordered. For contents of a given priority flowing through a single path, 
we define a content processing path as consisting of one incoming 
channel, one exchange, one queue, and one outgoing channel.

Guidelines for implementors:
 The server MUST preserve the order of contents flowing through a 
single content processing path, unless the redelivered field is set on 
the Basic.Deliver or Basic.Get-Ok methods.

> Following is the block of code that I am using to dequeue:

The code itself looks fine, but the context in which this code is 
invoked is important. The most common cause of re-ordering is when a 
consumer is terminated prior to acknowledging all the messages it has 
been sent.



More information about the rabbitmq-discuss mailing list