Updated on 2024-10-25 GMT+08:00

Deleting RabbitMQ Queues

This section describes how to delete queues. Deleting a queue removes all its configurations including exchange-queue bindings permanently.

Methods of deleting a queue:

The three methods are supported in RabbitMQ 3.x.x. For RabbitMQ AMQP-0-9-1 instances, queues can only be deleted on the console.

Prerequisite

A queue has been created.

Deleting a Queue (Console)

  1. Log in to the console.
  2. In the upper left corner, click and select a region.

    Select the region where your RabbitMQ instance is.

  3. Click and choose Middleware > Distributed Message Service for RabbitMQ to open the console of DMS for RabbitMQ.
  4. Click an instance name to go to the instance details page.
  5. In the navigation pane, choose Virtual Hosts.
  6. Click a virtual host name.
  7. On the Queue tab page, delete queues in either of the following ways:

    • Select one or more queues and click Delete Queue in the upper left corner.
    • In the row containing the desired queue, click Delete.

  8. Click OK.

Deleting a Queue (RabbitMQ Management UI)

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

    Figure 1 Queues

  3. Click Delete Queue.

    Figure 2 Deleting a queue

Deleting Queues in Batches (RabbitMQ Management UI)

Add a policy to delete multiple queues at a time. The policy has the same prefix as the queues to be deleted, and the queue TTL is 1 ms.

  1. Log in to the RabbitMQ management UI.
  2. On the Admin > Policies page, add a policy.

    Figure 3 Adding a policy to delete queues in batches
    Table 1 Policy elements

    Parameter

    Description

    Name

    The policy name, which can be customized.

    Pattern

    Queue matching mode. Enter a queue name. Queues containing this queue name will be matched.

    If this parameter is set to .*, all queues are matched. If this parameter is set to .*queue-name, all queues whose names contain queue-name are matched.

    Apply to

    Object to which the policy applies. Select Queues.

    Priority

    A larger value indicates a higher priority.

    Definition

    TTL, in milliseconds. Set expires to 1, indicating that the queue expiration time is 1 ms.

  3. Click Add policy.

    On the Queues tab page, check whether the queues are successfully deleted.

  4. After the queues are deleted, choose Admin > Policies, locate the row containing the policy added in 2, and click Clear to delete the policy.

    If this policy is retained, it will also apply to queues created later, and queues may be deleted by mistake.
    Figure 4 Deleting the policy