[rabbitmq-discuss] RabbitMQ as a reliable message queue

Emile Joubert emile at rabbitmq.com
Wed Jun 15 10:54:28 BST 2011


On 14/06/11 17:08, Jason J. W. Williams wrote:
>> Is it possible to use RabbitMQ as a reliable message queue? What I
>> mean is to make it preserve the order of messages in queues even for
>> non ack'ed durable messages.
>> Putting non acked messages into the end of the queue just doesn't make sence.
> 
> Actually, it would be difficult to preserve the order in the case of
> non-ack. Let's say you've got M1, M2, M3, M4 in the queue (like the
> FAQ describes). If you have two consumers, and C1 is consuming M1 and
> C2 is consuming M2. C1 finishes, acks M1 and starts consuming M3.
> However, C2 fails and disconnects without acking M2, where should M2
> go in the order? M3 is already being consumed. The only sane approach
> is to treat M2 as a new submission and append it to the end of the
> queue.

Yes, it is not obvious how to requeue in the presence of multiple
consumers. But it is possible to do better in the case of a single
consumer where the inconsistency can't arise. At present rabbit always
requeues at the back of the queue, i.e. treat it as a new message. This
is consistent with the spec which only guarantees ordering along the
same path from a single producer to a single consumer.


-Emile


More information about the rabbitmq-discuss mailing list