In the rabbitmq documentation it is said<div><i><br></i></div><div><h3 class="faqHeading"><i>I have read that RabbitMQ preserves the order of messages in queues. Is this correct?</i></h3>
<div class="faqAnswer">
<p><i>For the most part, yes. Say a publisher publishes messages M1,
M2, M3 and M4 (in that order) on the same channel
and with the same routing information. If these messages are
routed to a queue then they will end up in the same order that
they were published. Consuming on the queue will yield M1, M2, M3
and then M4.</i></p>
<p><i>However, the order is only guaranteed in the absence of
requeuing. A message will be implicitly requeued if a consumer
closes the channel before ack'ing a message. For example, if a
consumer receives M1, fails to ack and closes the channel then
the next consumer will receive messages in the order M2, M3, M4,
M1. Messages can also be explicitly requeued if the consumer
calls <span class="code ">basic.recover{requeue=true}</span>. The FAQ on <a href="http://www.rabbitmq.com/faq.html#at-least-once-delivery">at least once delivery</a> talks
about this in some more detail.</i> </p><p><br></p><p>I have only one consumer which should process messages in the order they are published. If my consumer gets M1 and crashes without acknowledging M1, then when I restart my consumer I want to process messages in the same order as they were published. Can this be achieved ? </p>
<p><br></p><p>thanks & regards,</p><p>ritesh rathi</p></div></div>