This topic describes how to create a storage resource queue of messages, view a dashboard, bind a queue to an exchange, view consumer tags, clear a queue, and delete a queue in the Message Queue for RabbitMQ console.

Background information

  • All messages of a Message Queue for RabbitMQ instance are stored in one or more queues.
  • A consumer tag is an identifier of a consumer client. You can specify the consumer tag on a Message Queue for RabbitMQ consumer client. If you do not specify the consumer tag on a Message Queue for RabbitMQ consumer client, the Message Queue for RabbitMQ broker automatically generates a unique consumer tag.
    Notice
    • Consumer tags must be unique. This means that a consumer tag used by a consumer client cannot be used by another consumer client at the same time.
    • A consumer tag is valid in only one channel. This means that the consumer tag created in a channel cannot be used in another channel.

Create a queue

  1. Log on to the Message Queue for RabbitMQ console.
  2. In the Resource Distribution section of the Overview page, select the region where your instance is located.
  3. On the Instances page, click the name of your instance.
  4. In the left-side navigation pane, click Queues.
  5. On the Queues page, click Change next to vhost. From the drop-down list, select the vhost on which you want to create a queue. Then, click Create Queue.
  6. In the Create Queue panel, enter a queue name in the Queue Name field and set the Auto Delete parameter. Click Advanced Settings and set the parameters for the queue. Then, click OK.
    Table 1. Parameters
    Parameter Description Note
    Queue Name The name of the queue.
    • The name can contain letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • The name must be 1 to 255 characters in length.
    • After a queue is created, you cannot modify its name. If you want to modify its name, delete the queue and create another queue.
    • A name that starts with amq. is used as a reserved field. For example, amq.test is an invalid name.
    Auto Delete Specifies whether the queue is deleted after the last subscription from consumers to this queue is canceled.
    • true: The queue is deleted after the last subscription from consumers to this queue is canceled.
    • false: The queue is not deleted after the last subscription from consumers to this queue is canceled.
    Advanced Settings Other parameters of the queue, such as the dead-letter exchange, dead-letter routing key, and message time-to-live (TTL).
    • DeadLetterExchange: the exchange to which dead-letter messages are sent.
    • DeadLetterRoutingKey: the routing key of a dead-letter message. A dead-letter exchange sends a dead-letter message to the queue whose binding key matches the routing key of the dead-letter message.
    • MessageTTL: the period of time for which a message can stay in a queue before it expires. Unit: milliseconds. A message that is not consumed within the message TTL is a dead-letter message. The dead-letter message is sent to a dead-letter exchange.
    On the Queues page, the created queue appears. create_queue_result

View statistics of a queue

  1. Log on to the Message Queue for RabbitMQ console.
  2. In the Resource Distribution section of the Overview page, select the region where your instance is located.
  3. On the Instances page, click the name of your instance.
  4. In the left-side navigation pane, click Queues.
  5. On the Queues page, click the drop-down arrow next to vhost. From the Change drop-down list, select the vhost where you want to view a queue. Then, find the queue.
  6. You can view statistics of the queue based on your requirements.
    • View statistics of the queue: Click the queue, or click Details in the Actions column. On the Queue Details page, click the Dashboard tab.
    • View statistics of the queue, such as vhost and instance statistics: In the Actions column of the queue, click Dashboard.

      You can also click the queue name, or click Details in the Actions column of the queue. In the upper-right corner of the Queue Details page, click Dashboard.

    The statistics vary based on the instance type. The following section provides details about the statistics for different instance editions.

View consumer tags

Notice Message Queue for RabbitMQ allows you to view consumer tags only for online consumer clients.
  1. Log on to the Message Queue for RabbitMQ console.
  2. In the Resource Distribution section of the Overview page, select the region where your instance is located.
  3. On the Instances page, click the name of your instance.
  4. In the left-side navigation pane, click Queues.
  5. On the Queues page, click the drop-down arrow next to vhost. From the Change drop-down list, select the vhost of the queue for which you want to view consumer tags. Find the queue, and choose More > consumerTags in the Actions column.

    You can also click the queue name, or click Details in the Actions column. On the Queue Details page, click the consumerTags tab.

    On the consumerTags tab, view the consumer tags of the queue.

Bind a queue to an exchange

  1. Log on to the Message Queue for RabbitMQ console.
  2. In the Resource Distribution section of the Overview page, select the region where your instance is located.
  3. On the Instances page, click the name of your instance.
  4. In the left-side navigation pane, click Queues.
  5. On the Queues page, click the drop-down arrow next to vhost. From the Change drop-down list, select the vhost of the queue that you want to bind to an exchange. Find the queue, and choose More > Bound as Destination in the Actions column.
    You can also click the queue name, or click Details in the Actions column.
  6. On the Bound as Destination tab of the Queue Details page, click Add Binding.
  7. In the Add Binding panel, configure Source Exchange and Binding Key. Then, click Confirm.
    Note
    A binding key must comply with the following rules:
    • A binding key cannot contain Chinese characters.
    • For exchange types other than the topic exchange type, a binding key must be 1 to 255 characters in length, and can contain only letters, digits, and the following special characters: -_./@
    • A binding key of the topic type can contain only letters, digits, and the following special characters: _-.#/@*. A binding key must be 1 to 255 characters in length. A binding key can start or end with a number sign (#).
    On the Bound as Destination tab, you can view the exchange to which the queue is bound. bg_queue_bound_result

Clear a queue

  1. Log on to the Message Queue for RabbitMQ console.
  2. In the Resource Distribution section of the Overview page, select the region where your instance is located.
  3. On the Instances page, click the name of your instance.
  4. In the left-side navigation pane, click Queues.
  5. On the Queues page, click Change next to vhost. From the drop-down list, select the vhost of the queue that you want to clear. Find the queue in the queue list, and choose More > Clear Messages in the Actions column.
    On the Queues page, click the drop-down arrow next to vhost. From the Change drop-down list, select the vhost of the queue that you want to clear. Then, click the queue name, or click Details in the Actions column. In the upper-right corner of the Queue Details page, click Clear Messages.
  6. In the Note message, read the note and click OK.
    The value of the Accumulated Messages parameter changes to 0.

Delete a queue

Notice When you delete a queue, messages that are not consumed in the queue are also deleted and cannot be recovered. Use caution when you delete queues.
  1. Log on to the Message Queue for RabbitMQ console.
  2. In the Resource Distribution section of the Overview page, select the region where your instance is located.
  3. On the Instances page, click the name of your instance.
  4. In the left-side navigation pane, click Queues.
  5. On the Queues page, click the drop-down arrow next to vhost. From the Change drop-down list, select the vhost from which you want to delete one or more queues. Then, delete queues by using one of the following methods:
    • Delete a single queue: Find the queue that you want to delete, and choose More > Delete in the Actions column.

      You can also click the queue name, or click Details in the Actions column. In the upper-right corner of the Queue Details page, click Delete.

    • To delete multiple queues, select the queues that you want to delete, and click Batch Delete below the queue list.
  6. In the Note message, read the note and click OK.