This topic describes how to create a queue to store messages, view a dashboard, bind a queue to an exchange, send messages to a specified queue, view consumer tags, clear a queue, and delete one or more queues in the Message Queue for RabbitMQ console.

Background information

  • All messages in 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 a consumer tag on a Message Queue for RabbitMQ consumer client. If you do not specify a consumer tag on a Message Queue for RabbitMQ consumer client, the Message Queue for RabbitMQ broker automatically generates a unique consumer tag.
    Important
    • A consumer tag must be unique and can be used by only one consumer client at a time.
    • A consumer tag is valid in only one channel. 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. In the left-side navigation pane, select Instances.
  2. In the top navigation bar of the Instances page, select a region. In the instance list, click the name of the instance that you want to manage.
  3. In the left-side navigation pane, click Queues.
  4. On the Queues page, click the drop-down arrow next to vhost. From the Change drop-down list, select the vhost on which you want to create a queue. Then, click Create Queue.
  5. In the Create Queue panel, enter a queue name in the Queue Name field and configure the Auto Delete parameter. Click Advanced Settings and configure the queue parameters that are displayed. Then, click OK.
    Table 1. Parameters
    ParameterDescriptionNote
    Queue NameThe 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 DeleteSpecifies 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 SettingsOther 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 queue that you created appears. create_queue_result

View the statistics of a queue

You can view various metric data to identify and locate problems at the earliest opportunity.

  1. On the Queues page, click the drop-down arrow next to vhost. From the Change drop-down list, select the vhost of the queue whose statistics you want to view. Then, find the queue.
  2. View the statistics of the queue based on your business requirements.
    • View the statistics of the queue: Click the queue, or click Details in the Actions column. On the Queue Details page, click the Dashboard tab.
    • View the statistics of the vhost or instance to which the queue belongs: In the Actions column of the queue, click Dashboard.

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

    The statistics of a queue vary based on the instance edition. The following section provides details about the statistics of different instance editions.
    • Basic Edition and Professional Edition: CloudMonitor is used to provide metric monitoring data. For more information about metrics provided by CloudMonitor, see Monitoring and alerting.
      Note Message Queue for RabbitMQ instances of the Basic Edition and Professional Edition are deprecated. You can continue to use the purchased instances of the Basic Edition.
    • Enterprise Edition and Platinum Edition: You can view metrics provided by Application Real-Time Monitoring Service (ARMS) Prometheus Service and Grafana. For more information about the dashboard and metrics, see Dashboard.

View consumer tags

Important Message Queue for RabbitMQ allows you to view only the consumer tags of online consumer clients.
On the Queues page, click the drop-down arrow next to vhost. From the Change drop-down list, select the vhost of the queue whose consumer tags you want to view. Find the queue, and choose More > consumerTags in the Actions column.

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

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

Bind an exchange to a queue

  1. On the Queues page, click the drop-down arrow next to vhost. From the Change drop-down list, select the vhost of the queue to which you want to bind an exchange. Find the queue and choose More > Bound as Destination in the Actions column.
  2. On the Bound as Destination tab of the Queue Details page, click Add Binding.
  3. In the Add Binding panel, configure the Source Exchange and Binding Key parameters. Then, click Confirm.
    Note
    A binding key must meet the following rules:
    • A binding key cannot contain Chinese characters.
    • For exchanges other than topic exchanges, a binding key must be 1 to 255 characters in length, and can contain only letters, digits, underscores (_), hyphens (-), periods (.), forward slashes (/), and at signs (@).
    • For topic exchanges, a binding key must be 1 to 255 characters in length, and can contain only letters, digits, underscores (_), hyphens (-), periods (.), number signs (#), forward slashes (/), at signs (@), and asterisks (*).

      If a binding key starts with a number sign (#) or an asterisk (*), a period (.) must be specified after the number sign (#) or asterisk (*). If a binding key ends with a number sign (#) or an asterisk (*), a period (.) must be specified before the number sign (#) or asterisk (*). If a binding key does not start or end with a number sign (#) or an asterisk (*), the key must start with a period (.) and end with a period (.).

    • If a bound exchange is of the x-consistent-hash type, the routing key indicates the weight of the queue to which the exchange is bound. The value of a weight must be a positive integer that ranges from 1 to 20.
    On the Bound as Destination tab, you can view the exchange that is bound to the queue. queue

Send messages

After you bind an exchange to a queue, you can send messages in the exchange to the specified queue in the Message Queue for RabbitMQ console.

  1. On the Queues page, click the drop-down arrow next to vhost. From the Change drop-down list, select the vhost of the queue to which you want to bind an exchange. Find the queue, and choose More > Bound as Destination in the Actions column.
  2. On the Queue Details page, select the Bound as Destination tab.
  3. In the Bound as Destination list, select the specified binding and click Send Message in the Actions column.
  4. In the Send Message panel that appears, configure messageId and messageBody, and click OK.

Clear a queue

  1. 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. Find the queue in the queue list, and choose More > Clear Messages in the Actions column.
  2. Read the Note message that appears and click OK.
    The value of the Accumulated Messages parameter changes to 0.

Delete queues

Warning When you delete a queue, messages that are not consumed in the queue are also deleted and cannot be restored. Exercise caution when you delete queues.
  1. 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.

    • Delete multiple queues: Select the queues that you want to delete, and click Batch Delete below the queue list.
  2. Read the Note message that appears and click OK.