Reputation: 744
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 !
Upvotes: 14
Views: 20036
Reputation: 472
Args.nack = function(tag, allUpTo, requeue)
So, the key is pass true to requeue param when you perform the nack.
Upvotes: 0
Reputation: 31
Another way would be to simply restart the rabbitmq instance.
/etc/init.d/rabbitmq-server restart
Upvotes: 3
Reputation: 72888
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.
Upvotes: 20