All Products
Search
Document Center

ApsaraMQ for RabbitMQ:CreateQueue

Last Updated:Oct 26, 2026

Creates a queue. A queue is an MSMQ. In ApsaraMQ for RabbitMQ, you send messages to a specified exchange, and then the exchange performs routing to attach the messages to a 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 instance ID of the ApsaraMQ for RabbitMQ (MSMQ) 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.

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

  • After a queue is created, its name cannot be modified. You must delete the queue and create a new one to change the name.

DemoQueue

AutoDeleteState

boolean

No

Specifies whether to automatically delete the queue. Valid values:

  • true: yes. If the last consumer that subscribes to the queue unsubscribes from the queue, the queue is automatically deleted.

  • false: no.

false

ExclusiveState

boolean

No

Specifies whether the exchange is exclusive. Valid values:

  • true: Yes. The exchange can be used only by the connection that declared it. The exchange is automatically deleted after the connection is closed.

  • false: No.

false

MessageTTL

integer

No

The time-to-live (TTL) of messages in the queue.

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

  • The TTL must be a non-negative integer. The maximum TTL is 1 day. Unit: milliseconds. For example, if the TTL of a message is set to 1000, the message remains in the queue for up to 1 second.

1000

AutoExpireState

integer

No

The automatic expiration time of the queue. If the queue is not accessed within the specified time, it is automatically deleted.

Unit: milliseconds.

Note

To use the feature corresponding to this parameter, you must activate it first. To activate the feature, submit a ticket.

10000

MaxLength

integer

No

This parameter is not supported in the current version.

The maximum number of messages in the queue. If the number of messages exceeds this value, the earliest messages in the queue are deleted.

1000

DeadLetterExchange

string

No

The dead-letter exchange. This type of exchange is used to accept messages that consumers deny.

If a consumer chooses to deny a message without requesting to send it again, ApsaraMQ for RabbitMQ (MSMQ) performs routing of the message to the specified dead-letter exchange. The exchange then performs routing to attach the message to a queue for row store.

DLExchange

DeadLetterRoutingKey

string

No

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

test.dl

MaximumPriority

integer

No

The priority of the queue. Recommended values: 1 to 10.

Note

This parameter is used for message priorities and is supported only by exclusive instances. To use this feature, you must activate it first. To activate 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.