All Products
Search
Document Center

ApsaraMQ for RabbitMQ:Queues

Last Updated:Jul 09, 2026

Queues buffer messages until consumers retrieve them. Create, monitor, bind, and delete queues in the ApsaraMQ for RabbitMQ console.

Prerequisites

Make sure that you have:

Create a queue

  1. Log in to the ApsaraMQ for RabbitMQ console. In the left-side navigation pane, click Instances.

  2. In the top navigation bar, select the region of your instance, then click the instance name.

  3. In the left-side navigation pane, click Queues.

  4. On the Queues page, click Change next to vhost and select the vhost on which to create a queue. Then, click Create Queue.

  5. In the Create Queue panel, configure the following parameters and click OK.

    Parameter

    Description

    Queue Name

    The queue name. Naming rules:

    1. 1. The queue name supports only letters, digits, hyphens (-), underscores (_), periods (.), pound signs (#), slashes (/), at signs (@), colons (:), commas (,), spaces ( ), and greater-than signs (>). Length: 1–255 characters.

    2. 2. After a queue is created, you cannot modify its name. If you want to modify its name, delete the queue and re-create it.

    3. amq. is a reserved prefix and cannot be used.

    Auto Delete

    Deletes the queue after the last consumer unsubscribes. Yes: enabled. No: disabled.

    Retry Policy

    Optional retry parameters.

    Dead-letter Policy

    Optional dead-letter parameters. Click to expand.

Retry policy

Parameter

Description

Inherit Instance Configurations

Whether to use the instance-level retry policy.

Maximum Number of Deliveries

Maximum delivery attempts for a message.

Consumption Timeout Period

Maximum time for a consumer to process a message.

Dead-letter policy

Parameter

Description

DeadLetterExchange

The exchange that receives dead-letter messages.

DeadLetterRoutingKey

The routing key used to route dead-letter messages to the target queue.

MessageTTL

Time-to-live in milliseconds. Unconsumed messages become dead letters after this period and route to the dead-letter exchange. Message TTL.

FAQ

Q: Can I specify which client consumes messages?

No. ApsaraMQ for RabbitMQ does not support specifying a particular consumer client. Message distribution follows the standard RabbitMQ round-robin or priority-based dispatching mechanisms.

Q: How do I create a sequential queue (x-single-active-consumer) via code?

The ApsaraMQ for RabbitMQ console does not support configuring the x-single-active-consumer parameter. To create a sequential queue, use the SDK. Call the channel.queueDeclare method and set "x-single-active-consumer": true in the arguments parameter.

Example:

Map<String, Object> arguments = new HashMap<>();
arguments.put("x-single-active-consumer", true);
channel.queueDeclare("my-queue", true, false, false, arguments);

Q: Why does auto-creating a queue fail (Failed to declare queue)?

ApsaraMQ for RabbitMQ does not support automatic creation of queues. Before declaring a queue in your code, you must manually create it in the console or by calling the API.

Maximum queue amount

If the quota amount of instance reached limit:

  • For Enterprise, Professional and Platium Edition instances, click Upgrade to upgrade.

  • For (Shared) Pay-by-Messaging-Request, (Shared) Pay-by-Provisioned-Capacity-and-Elastic-Traffic, (Exclusive) Pay-by-Provisioned-Capacity-and-Elastic-Traffic instances, click Change Quota to adjust the amount limit of Queue.

For amount limit of different instances, see Queues per instance under Cluster limits in Limits.

View queue statistics

Metrics vary by instance edition.

  1. On the Queues page, find the target queue and click Details in the Actions column.

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

    Dashboard

    Standard Edition, Professional Edition

    Cloud Monitor

    Monitoring

Note

Standard Edition is no longer available for purchase. Existing instances can still be used.

Bind an exchange to a queue

  1. On the Queues page, find the target queue and click Details in the Actions column.

  2. On the Queue Details page, click the Bound as Destination tab. Then, click Add Binding.

  3. In the Add Binding panel, configure Source Exchange and Routing Key, then click OK.

Note

For x-consistent-hash exchanges, the routing key specifies the queue weight (an integer from 1 to 20).

Send messages to a queue

Send messages to a queue from a bound exchange.

  1. On the Queues page, find the target queue and click Details in the Actions column.

  2. On the Queue Details page, click the Bound as Destination tab.

  3. In the binding list, find the target binding and click Send Message in the Actions column.

  4. In the Send Message panel, select a mandatory option, enter a Message ID and Message Body, then click OK.

Note

When sending messages using the default exchange (with an empty exchange name), the routing key must exactly match an existing queue name. The client account must also have write permissions on the target queue. If the queue does not exist or permissions are insufficient, messages are silently discarded with no send record in the console. Before sending messages, verify that the queue is correctly declared and that the client account has the required write permissions.

View consumer tags

A consumer tag uniquely identifies a consumer client. The broker auto-generates one if the client does not specify one. Use the auto-generated tag instead of a custom one.

Important

Each consumer tag must be unique to a single client. The SDK tracks consumers on a connection using a Map<String, Consumer> keyed by consumer tag. If consumers on the same connection share a tag, only one resumes after 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

Warning

Deleting a queue permanently removes all unconsumed messages. This action cannot be undone.

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

  2. Confirm the deletion.