FAQ: How to purge unacked messages from a queue in RabbitMQ

Question: Multiple queues in our broker have a lot of messages. We tried to clear the piled-up messages by purging the queue, but only the ready state queues got deleted. There are still queues with messages that are in an "unacked" state. How can I clear them?

Close the channel that the unacked messages reside on, which requires you to add the messages back to the queue into a ready state. Then, purge the queue. The channel related to a consumer can be seen by pressing the queue with unacked messages.

Recent versions of RabbitMQ include the ability to configure a consumer timeout, which is the maximum time a consumer can spend processing a message before the channel is terminated.

If a consumer does not ack its delivery for more than the timeout value (30 minutes by default), its channel will be closed with a PRECONDITION_FAILED channel exception.

The timeout value is configurable in [rabbitmq.conf] (in milliseconds):

# 30 minutes in milliseconds
consumer_timeout = 1800000

CloudAMQP - industry leading RabbitMQ as a service

Start your managed cluster today. CloudAMQP is 100% free to try.

13,000+ users including these smart companies