[rabbitmq-discuss] Sematics of ACK/REQUEUE/DISCARD on a message

Matthew Sackman matthew at lshift.net
Wed May 5 20:03:22 BST 2010

On Wed, May 05, 2010 at 07:51:35PM +0200, Andreas Jung wrote:
> Two questions:
> - - assuming a consumer could process a message with success - what is
>   the difference in the message handling inside the queue between
>   acknowledging it or discarding it - it will be removed from the queue
>   in both cases?!

If you don't ack it, it will be retained by RabbitMQ and will be
redelivered to some other consumer eventually when your current
consumer cancels/dies.

> - - assuming a consumer could not process a message properly (e.g. some
>   database backend down) and is interested to re-try this message later.
>   In this case I would requeue the message. At which position in the
>   queue will the message be inserted? At the end of the queue?

Basic.reject is not implemented. Calling basic.recover{requeue=true}
will requeue all non-acknowledged messages outstanding on the current
*channel*. Note this is not queue specific.

The specification is silent as to where in the queues the messages
should be reentered and you should not rely on any particular behaviour.
Currently RabbitMQ requeues messages at the end of the queue (i.e. they
behave like new publishes), but that can change.


More information about the rabbitmq-discuss mailing list