Click the Queue tab and go to the bottom of the page. You will find a dropdown "Delete / Purge" there. Press Purge to the right to empty the queue.
If you use the CLEAR command, all of the messages are cleared from the queue.
Store all message in Database (and empty queue) For the messages, you want to delete you can simply ignore them in the consumer, or of course delete them from the database, as you can use queries to do that!
you can directly run this command
sudo rabbitmqctl purge_queue queue_name
rabbitmqadmin is the perfect tool for this
rabbitmqadmin purge queue name=name_of_the_queue_to_be_purged
RabbitMQ has 2 things under queue
Delete - will delete the queue
Purge - This will empty the queue (meaning removes messages from the queue but queue still exists)
To purge queue you can use following command (more information in API doc):
curl -i -u guest:guest -XDELETE http://localhost:15672/api/queues/vhost_name/queue_name/contents
RabbitMQ implements the Advanced Message Queuing Protocol (AMQP) so you can use generic tools for stuff like this.
On Debian/Ubuntu or similar system, do:
sudo apt-get install amqp-tools
amqp-delete-queue -q celery # where celery is the name of the queue to delete
IMPORTANT NOTE: This will delete all users and config.
ALERT !!
ALERT !!
I don't suggest this answer until unless you want to delete data from all of the queues, including users and configs. Just Reset it !!!
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl start_app
I guess its late but for others reference, this can be done with pika
import pika
host_ip = #host ip
channel = pika.BlockingConnection(pika.ConnectionParameters(host_ip,
5672,
"/",
credentials=pika.PlainCredentials("username","pwd"))).channel()
print "deleting queue..", channel.queue_delete(queue=queue_name)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With