How to push messages from unacked to ready, rabbitmq

11,332

Solution 1

there are 2 ways to move a message from unack'd to ready:

1) ack the message from your consumer

2) shut down the consumer that is holding them open

most likely, option #1 is not really an option. when a message gets stuck in unack'd, it's usually because the consumer lost track of the message and can't ack it anymore.

this typically leaves #2: you'll need to shut down all consumers that had previously been attached to that queue. when a message is unack'd and the consumer drops, RMQ will push the message back into ready.

if you shut down your consumers and restarting them puts the messages back into unack'd state, then you need to figure out what's causing the error in your consumer, fix the code and restart it again.

Solution 2

Another way would be to simply restart the rabbitmq instance.

/etc/init.d/rabbitmq-server restart
Share:
11,332

Related videos on Youtube

user3123372
Author by

user3123372

Updated on June 04, 2022

Comments

  • user3123372
    user3123372 almost 2 years

    RabbitMq is used in our application There are hundreds of messeges accumulated in time, in unacked state for couple of queues, and TTLs isn't working because of several unexpected shutdowns when the listener wasn't alive .

    Now for business reason I cant just empty the queue. I want to push the unacked messages manually to ready state.

    Is there any ??

    Thanks !

  • user3123372
    user3123372 about 7 years
    is there a third way ??