Updated on 2026-04-21 GMT+08:00

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)

  1. Log in to the RabbitMQ console.
  2. Click in the upper left corner to select the region where your instance is located.
  3. Click an instance name to go to the instance details page.
  4. In the navigation pane, choose Instance > Virtual Hosts.
  5. Click a virtual host name to go to the virtual host details page.
  6. 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.

  7. Click OK.

    A dialog box is displayed, indicating that messages in the queue are cleared successfully.

Clearing Messages in a Queue (RabbitMQ Management UI)

  1. Log in to the RabbitMQ management UI.
  2. On the Queues tab page, click the name of a queue.

    Figure 1 Queues

  3. 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.