Bootstrap FreeKB - RabbitMQ - Delete messages using the rabbitmqctl command
RabbitMQ - Delete messages using the rabbitmqctl command

Updated:   |  RabbitMQ articles

The rabbitmqctl command with the purge_queues option can be used to purge (permanently delete) all of the messages in a queue. The messages cannot be recovered after they are purged.

rabbitmqctl purge_queue queue_name

 

Optionally, the -p option can be used to specify the virtual host (vhost).

rabbitmqctl purge_queue queue_name -p vhost001

 

Before purging a queue, the list_queues command can be used to list the number of messages in the queue. In this example, there are 17 messages in queue002.

~]# rabbitmqctl list_queues -p vhost001

Listing queues for vhost vhost001
name     messages
queue001 0
queue002 17

 

You can specify the items you wish to include in the output, like this.

rabbitmqctl purge_queue queue002 -p vhost001

 

Something like this should be displayed.

Purging queue 'queue001' in vhost 'vhost001' ...

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter f4d251 in the box below so that we can be sure you are a human.