Queues in ApsaraMQ for RabbitMQ buffer messages until consumers retrieve and process them. Exchanges route messages to one or more queues based on bindings and routing keys. You can create, monitor, bind, and delete queues in the ApsaraMQ for RabbitMQ console.
Prerequisites
Before you begin, make sure that you have:
An ApsaraMQ for RabbitMQ instance
A vhost on the instance where you want to create queues
(Optional) If you use a RAM user to access ApsaraMQ for RabbitMQ, the required permissions must be granted to the RAM user. For more information, see Grant permissions to a RAM user.
Create a queue
Log in to the ApsaraMQ for RabbitMQ console. In the left-side navigation pane, click Instances.
In the top navigation bar, select the region of your instance. Click the instance name in the instance list.
In the left-side navigation pane, click Queues.
On the Queues page, click Change next to vhost and select the vhost on which to create a queue. Then, click Create Queue.
In the Create Queue panel, configure the following parameters and click OK.
Parameter
Description
Queue Name
The queue name. Naming rules:
Allowed characters: letters, digits, hyphens (
-), underscores (_), periods (.), and at signs (@).Length: 1 to 255 characters.
Cannot be changed after creation. To rename a queue, delete it and create a new one.
amq.is a reserved prefix and cannot be used.
Auto Delete
Whether the queue is automatically deleted after the last consumer unsubscribes. Set to Yes to enable auto-deletion, or No to disable it.
Retry Policy
Optional retry parameters.
Dead-letter Policy
Optional dead-letter parameters. Click to expand.
Retry policy
Parameter | Description |
Inherit Instance Configurations | Whether to inherit the retry policy from the instance-level configuration. |
Maximum Number of Deliveries | The maximum number of times a message can be delivered. |
Consumption Timeout Period | The maximum time allowed for a consumer to process a message. |
Dead-letter policy
Parameter | Description |
DeadLetterExchange | The exchange to which dead-letter messages are delivered. |
DeadLetterRoutingKey | The routing key for dead-letter messages. The dead-letter exchange routes messages to the queue whose routing key matches this value. |
MessageTTL | The message time-to-live (TTL), in milliseconds. A message not consumed within this period becomes a dead-letter message and is sent to the dead-letter exchange. For more information, see Message TTL. |
View queue statistics
Monitor queue metrics to identify and troubleshoot issues early. The available metrics depend on your instance edition.
On the Queues page, find the target queue and click Details in the Actions column.
On the Queue Details page, click the Dashboard tab.
Instance edition
Monitoring source
Reference
Enterprise Edition, Enterprise Platinum Edition
Managed Service for Prometheus and Managed Service for Grafana
Standard Edition, Professional Edition
CloudMonitor
Standard Edition instances are no longer available for purchase. Existing Standard Edition instances can still be used.
Bind an exchange to a queue
On the Queues page, find the target queue and click Details in the Actions column.
On the Queue Details page, click the Bound as Destination tab. Then, click Add Binding.
In the Add Binding panel, configure Source Exchange and Routing Key, then click OK.
For an x-consistent-hash type exchange, the routing key represents the weight of the queue. The weight must be an integer from 1 to 20.
Send messages to a queue
After binding an exchange to a queue, send messages from the exchange to the queue in the console.
On the Queues page, find the target queue and click Details in the Actions column.
On the Queue Details page, click the Bound as Destination tab.
In the binding list, find the target binding and click Send Message in the Actions column.
In the Send Message panel, select a mandatory option, enter a Message ID and Message Body, then click OK.
View consumer tags
A consumer tag is a unique identifier for a consumer client. If a consumer client does not specify a tag, the ApsaraMQ for RabbitMQ broker generates one automatically. Use the default system-generated consumer tag instead of a custom one.
A consumer tag must be unique and can only be used by one consumer client at a time. The SDK tracks consumers on a connection using a Map<String, Consumer> keyed by consumer tag. If multiple consumers on the same connection share a consumer tag, only one of them resumes consumption after an automatic reconnection. The others are not restored.
To view consumer tags, the consumer client must be connected to the broker. On the Queues page, find the target queue and click Consumer Tags in the Actions column.
Clear a queue
On the Queues page, find the target queue and choose More > Clear Messages in the Actions column.
Delete queues
Deleting a queue permanently deletes all unconsumed messages in the queue. This action cannot be undone.
On the Queues page, delete queues using one of the following methods:
Single queue: Find the queue and choose More > Delete in the Actions column. Alternatively, click the queue name or click Details, then click Delete in the upper-right corner of the Queue Details page.
Multiple queues: Select the queues and click Batch Delete below the queue list.
Read and confirm the deletion notice.