[rabbitmq-discuss] Ack'ing messages
Denny Swindle
denny.swindle at gmail.com
Tue May 10 19:37:39 BST 2011
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). 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?
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110510/e394da77/attachment.htm>
More information about the rabbitmq-discuss
mailing list