Clearing Messages in a RabbitMQ Queue
Clear RabbitMQ messages in a queue when:
- The producer is abnormal and sends a large number of invalid, duplicate, or incorrect messages to the queue.
- The service logic of the consumer has been modified, and the existing messages in the queue are no longer suitable for the new service.
- The consumer has been faulty for a long time, and the messages in the queue are time-sensitive. The existing messages in the queue are useless.
Methods of deleting messages:
Notes and Constraints
- All the messages in the queue will be deleted permanently and cannot be restored. Exercise caution.
- The two methods are supported for RabbitMQ 3.x.x. For RabbitMQ AMQP-0-9-1 instances, messages in a queue can only be cleared on the console.
Prerequisite
A queue has been created and messages have been produced in it.
Clearing Messages in a Queue (Console)
- Log in to the RabbitMQ console.
- Click
in the upper left corner to select the region where your instance is located. - Click an instance name to go to the instance details page.
- In the navigation pane, choose Instance > Virtual Hosts.
- Click a virtual host name to go to the virtual host details page.
- On the Queue tab page, click Clear Message in the row containing the desired queue. The Clear Message dialog box is displayed.
All the messages in the queue will be deleted permanently and cannot be restored. Exercise caution.
- Click OK.
A dialog box is displayed, indicating that messages in the queue are cleared successfully.
Clearing Messages in a Queue (RabbitMQ Management UI)
- Log in to the RabbitMQ management UI.
- On the Queues tab page, click the name of a queue. Figure 1 Queues
- Click Purge Messages to remove messages from the queue. Figure 2 Clearing messages in a queue
All the messages in the queue will be deleted permanently and cannot be restored. Exercise caution.
Related Document
To clear messages in a queue by calling an API, see Clearing Messages in a Queue.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.