0

I have two unacknowledged messages in a queue which need to be redelivered. I did a research and have seen that I need to use basic.recover or basic.nack however I don't really know how to use them since my RabbitMQ knowledge is one day old. Could please someone show me the way of using these options? I couldn't find any example.

Note: Probably irrelevant but I'm using Symfony2 app with RabbitMqBundle on MAC OSX.

$ rabbitmqctl list_queues name messages_ready messages_unacknowledged
Listing queues ...
order_create_qu 0   2

I've read How can I recover unacknowledged AMQP messages from other channels than my connection's own? and Ack or Nack in rabbitMQ posts but didn't really work out how to use suggested solutions apart from restarting the server.

enter image description here enter image description here

Community
  • 1
  • 1
BentCoder
  • 12,257
  • 22
  • 93
  • 165

2 Answers2

0

The unacknowledged messages will stay unacknowledged until the consumer that received them has either rejected or nacked the message, or the connection/channel has been closed.

When the connection/channel dies, Rabbitmq assumes that those messages were not processed, and so they become available for delivery to another consumer.

To prevent this from happening in the future, you should have some logic in the consumer that rejects/nacks a message if the consumer won't do anything with it and/or logic that properly closes the connection/channel to rabbitmq.

Andrew Huang
  • 132
  • 5
  • You explained what it is and why it would occur which is something I already know but didn't realy answer my question. – BentCoder Feb 01 '16 at 08:37
0

The solution seems to be very simple. If you close the connection which has unacknowledged messages to it, the messages get delivered to other connections and get processes. In my case, manually closed connection 53191 which solved the problem.

.... but that consumer hasn't yet closed the channel or connection over which it originally received them.....

I actually oversaw the hint above which was mentioned in accepted answer here: How can I recover unacknowledged AMQP messages from other channels than my connection's own?

Community
  • 1
  • 1
BentCoder
  • 12,257
  • 22
  • 93
  • 165