[rabbitmq-discuss] Ack'ing messages

Marek Majkowski majek04 at gmail.com
Wed May 11 11:46:39 BST 2011

On Tue, May 10, 2011 at 19:37, Denny Swindle <denny.swindle at gmail.com> wrote:
> I'm trying to understand the CORRECT way of handling messages that cannot be
> processed, for some reason.
> I have two consumers listening for messages (in a worker queue setup, as
> described here: http://www.rabbitmq.com/tutorials/tutorial-two-python.html).
> Scenario A:
> A message is received and processed, then it's ack'd using basic_ack.
> Scenario B:
> A message is received and processed, but an error occurs.  An error like my
> consumer loses connection to the DB.  In this case, I don't issue a
> basic_ack (and my consumer remains running).
> In looking at the docs, I understand if a message is not acknowledged and
> the consumer dies, rabbit will requeue the message for redelivery.


> But what
> if the consumer remains running (and I just can't process the message).

The message will be stalled, until the consumer dies.

>  Should I not issue the basic_ack (will it get sent to another consumer)?
>  Or should I issue the basic_ack and then reject the message?

Take a look at basic.reject:

> I'm asking because earlier today I noticed I had an "unacknowledged" message
> on my queue.   With the unacknowledged message on the queue, only one worker
> consumer was receiving all messages.
> [root at web2 tmp]# rabbitmqctl list_queues -p / messages
> messages_unacknowledged messages_ready
> Listing queues ...
> 1 1 0
> 0 0 0
> 0 0 0
> 0 0 0
> The other worker was in a 'stale' state and not receiving any messages.  I'm
> just trying to understand if my logic on not ack'ing a message is correct
> and if that's how i ended up with an unacknowledged message.  Also trying to
> understand why my worker just stopped receiving messages.
> Any guidance would be appreciated!
> Thanks
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

More information about the rabbitmq-discuss mailing list