I want to delete all the messages from the rabbit mq queue before i start pushing data in it. How can this be achieved ? I am using https://www.npmjs.com/package/amqplib
2 Answers
6
votes
there's a purgeQueue method: http://www.squaremobius.net/amqp.node/channel_api.html#channel_purgeQueue
channel.purgeQueue("some.queue");0
votes
purge_queue can be used to remove all undelivered messages from the queue named.
purgeQueue(queue, [function(err, ok) {...}])
Remove all undelivered messages from the queue named.messageCount, containing the number of messages purged from the queue is returned.
You can also do this using command-line:
sudo rabbitmqctl purge_queue queue_name