Creates a queue.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateQueue

The operation that you want to perform.

Set the value to CreateQueue.

InstanceId String Yes amqp-cn-v0h1kb9nu***

The ID of the instance.

MaxLength Long Yes 1000

The maximum number of messages that can be stored in the queue.

If this threshold is exceeded, the earliest messages that are routed to the queue are discarded.

QueueName String Yes DemoQueue

The name of the queue.

  • The queue name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), and at signs (@).
  • After the queue is created, you cannot modify its name. If you want to modify its name, delete the queue and create a new queue.
RegionId String Yes cn-hangzhou

The ID of the region.

VirtualHost String Yes test

The name of the vhost.

AutoDeleteState Boolean No false

Specifies whether the Auto Delete attribute is configured. Valid values:

  • true: The Auto Delete attribute is configured. The queue is automatically deleted after the last subscription from consumers to this queue is canceled.
  • false: The Auto Delete attribute is not configured.
ExclusiveState Boolean No false

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

  • true: The queue is an exclusive queue. It can be used only for the connection that declares the exclusive queue. After the connection is closed, the exclusive queue is automatically deleted.
  • false: The queue is not an exclusive queue.
MessageTTL Long No 1000

The message TTL of the queue.

  • If the retention period of a message in the queue exceeds the message TTL of the queue, the message expires.
  • Message TTL must be set to a non-negative integer, in milliseconds. For example, if the message TTL of the queue is 1000, messages survive for at most 1 second in the queue.
AutoExpireState Long No 10000

The validity period after which the queue is automatically deleted.

If the queue is not accessed within a specified period of time, it is automatically deleted.

DeadLetterExchange String No DLExchange

The dead-letter exchange. A dead-letter exchange is used to receive rejected messages.

If a consumer rejects a message that cannot be retried, this message is routed to a specified dead-letter exchange. Then, the dead-letter exchange routes the message to the queue that is bound to the dead-letter exchange.

DeadLetterRoutingKey String No test.dl

The dead-letter routing key.

MaximumPriority Integer No 10

The highest priority supported by the queue. This parameter is set to a positive integer.

  • Valid values: 0 to 255
  • Recommended values: 1 to 10

Response parameters

Parameter Type Example Description
RequestId String 59B52E2C-0B8E-44EC-A314-D0314A50***

The ID of the request.


Sample requests

&<Common request parameters>

Sample success responses

XML format


JSON format


Error codes

For a list of error codes, visit the API Error Center.