FAQ
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>

Search Discussions

  • Marek Majkowski at May 11, 2011 at 10:46 am

    On Tue, May 10, 2011 at 19:37, Denny Swindle 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. Correct.
    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:
    http://www.rabbitmq.com/blog/2010/08/03/well-ill-let-you-go-basicreject-in-rabbitmq/
    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprabbitmq-discuss @
categoriesrabbitmq
postedMay 10, '11 at 6:37p
activeMay 11, '11 at 10:46a
posts2
users2
websiterabbitmq.com
irc#rabbitmq

2 users in discussion

Denny Swindle: 1 post Marek Majkowski: 1 post

People

Translate

site design / logo © 2021 Grokbase