RabbitMQ - purge a queue from all of its unacked messages

后端 未结 8 727
孤街浪徒
孤街浪徒 2020-12-29 03:03

I have thousands of unacked messages in my dev environment which I can\'t restart.
Is there a way to remove (purge) all messages even if they are unacknowledged?

相关标签:
8条回答
  • 2020-12-29 03:56

    You need to put messages back into the queue before you can purge them:

    • close the channel
    • close the connection (the script doesn't work for me)

    As an alternative, this doesn't require to wait:

    • delete and recreate the queue
    • restart the server
    0 讨论(0)
  • 2020-12-29 04:00

    If you want to clear the contents of the queue, then you can use the AMQP method queue.purge: There is queue purge in AMQP: http://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.purge

    You could do similar using the management plugin.

    0 讨论(0)
提交回复
热议问题