All Products
Search
Document Center

ApsaraMQ for RabbitMQ:CreateQueue

Last Updated:Oct 15, 2025

A queue is a buffer that stores messages. In ApsaraMQ for RabbitMQ, messages are sent to a specified exchange and then routed to a bound queue.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

amqp:CreateQueue

create

*Queue

acs:amqp:{#regionId}:{#accountId}:/instances/{#instanceId}/vhosts/{#vhostName}/queues/*

None None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The ID of the ApsaraMQ for RabbitMQ instance to which the queue belongs.

amqp-cn-v0h1kb9nu***

VirtualHost

string

Yes

The name of the vhost to which the queue belongs. The name can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@). The name must be 1 to 255 characters in length.

test

QueueName

string

Yes

The name of the queue to create.

  • The queue name can contain only 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, its name cannot be changed. To change the name, delete the queue and create a new one.

DemoQueue

AutoDeleteState

boolean

No

Specifies whether to automatically delete the queue. Valid values:

  • true: The queue is automatically deleted after the last consumer unsubscribes from it.

  • false: The queue is not automatically deleted.

false

ExclusiveState

boolean

No

Specifies whether the queue is an exclusive queue. Valid values:

  • true: The queue is an exclusive queue. An exclusive queue can be used only by the connection that declares it. The queue is automatically deleted after the connection is closed.

  • false: The queue is not an exclusive queue.

false

MessageTTL

integer

No

The time to live (TTL) of a message in the queue.

  • A message expires if its retention time in the queue exceeds the configured TTL.

  • The message TTL must be a non-negative integer. The maximum value is 1 day. The unit is milliseconds. For example, if the value is 1000, the message can be stored in the queue for a maximum of 1 second.

1000

AutoExpireState

integer

No

The auto-expiration time for the queue. The queue is automatically deleted if it is not accessed within the specified time period.

Unit: milliseconds.

Note

This feature must be enabled before you can use this parameter. To enable the feature, submit a ticket.

10000

MaxLength

integer

No

This parameter is not supported in the current version.

The maximum number of messages that can be stored in the queue. If this limit is exceeded, the earliest messages in the queue are deleted.

1000

DeadLetterExchange

string

No

The dead-letter exchange. This type of exchange is used to receive rejected messages.

If a consumer rejects a message and the message is not requeued, ApsaraMQ for RabbitMQ routes the message to the specified dead-letter exchange. The dead-letter exchange then routes the message to a bound queue for storage.

DLExchange

DeadLetterRoutingKey

string

No

The dead-letter routing key. The key can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@). The key must be 1 to 255 characters in length.

test.dl

MaximumPriority

integer

No

The priority of the queue. The recommended value is an integer from 1 to 10.

Note

This parameter is used for message priority. It is supported only by dedicated instances and can be used only after the message priority feature is enabled. To enable the feature, submit a ticket.

10

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

59B52E2C-0B8E-44EC-A314-D0314A50***

Examples

Success response

JSON format

{
  "RequestId": "59B52E2C-0B8E-44EC-A314-D0314A50***"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.