1
votes

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

2 Answers

6
votes
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