Thursday, December 23, 2021

RabbitMQ How to Purge All Queues ?

 There are some situations where you may need to clear or purge all messages from a queue. 


Using Command Line:


You can purge or clear a queue with the following command:


syntax:


$ rabbitmqctl purge_queue queue_name


Purge Queue from the Web UI


Click on the Queues tab.

Click on the name of the queue that you want.

Expand the “Purge” section.

Click the “Purge Messages” button.

Click “OK”.



Purging all queues 


$ rabbitmqadmin -f tsv -q list queues name > list1.txt


$ for i in `cat list1.txt`; do rabbitmqctl purge_queue "$i" ; done