RabbitMQ - purge a queue from all of its unacked messages

Close the channel that the unacked messages reside on, which will nack them back into the queue, then call purge.


Once there are no "ready" messages in the queue, delete it and recreate.


You have to make consumer ack them (or nack) and only after that they will be removed. Alternatively you can shutdown consumers and purge the queue completely.

If you are looking for some way to purge all unacked messages - there are no such feature nor in AMQP protocol neither in RabbitMQ.

It looks like your consumer is the cause of the problem, so you have to adjust it (rewrite) to release message immediately after it processed or failed.

Tags:

Rabbitmq