Creates a queue.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesCreateQueue

The operation that you want to perform. Set the value to

CreateQueue.

InstanceIdStringYesamqp-cn-v0h1kb9nu***

The ID of the instance.

QueueNameStringYesDemoQueue

The name of the queue to be created.

  • The name must be 1 to 255 characters in length, and can contain only letters, digits, and the following special characters: -_.#/@
  • After the queue is created, you cannot change the name of the queue. If you want to modify the name of the queue, delete the queue and create another queue.
RegionIdStringYescn-hangzhou

The ID of the region.

VirtualHostStringYestest

The name of the virtual host (vhost).

The name must be 1 to 255 characters in length, and can contain only letters, digits, and the following special characters: -_.#/@

AutoDeleteStateBooleanNofalse

Specifies whether to automatically delete the queue. Valid values:

  • true: The queue is automatically deleted. After the last subscription from consumers to this queue is canceled, the queue is automatically deleted.
  • false: The queue is not automatically deleted.
ExclusiveStateBooleanNofalse

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

  • true: The exchange is an exclusive exchange. Only the connection that declares the exclusive exchange can use the exclusive exchange. After the connection is closed, the exclusive exchange is automatically deleted.
  • false: The exchange is not an exclusive exchange.
MessageTTLLongNo1000

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

  • If the retention period of a message in the queue exceeds the message TTL of the queue, the message expires.
  • The message TTL must be set to a non-negative integer. The maximum message TTL is one day. Unit: milliseconds. For example, if the message TTL of the queue is 1,000 ms, messages survive for at most 1 second in the queue.
AutoExpireStateLongNo10000

The validity period after which the queue is automatically deleted. If the queue is not accessed within the specified period of time, the queue is automatically deleted.

Unit: milliseconds.

Note You can use the feature that corresponds to this parameter only after you enable the feature. To use this feature, submit a ticket.
MaxLengthLongNo1000

The current version does not support this parameter.

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.

DeadLetterExchangeStringNoDLExchange

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 the specified dead-letter exchange. Then, the dead-letter exchange routes the message to the queue that is bound to the dead-letter exchange.

DeadLetterRoutingKeyStringNotest.dl

The dead-letter routing key.

The name must be 1 to 255 characters in length, and can contain only letters, digits, and the following special characters: -_.#/@

MaximumPriorityIntegerNo10

Queue priorities are not supported. The value does not affect the call and return results.

Response parameters

ParameterTypeExampleDescription
RequestIdString59B52E2C-0B8E-44EC-A314-D0314A50***

The ID of the request.

Examples

Sample requests

http(s)://amqp-open.cn-hangzhou.aliyuncs.com/?Action=CreateQueue
&InstanceId=amqp-cn-v0h1kb9nu***
&MaxLength=1000
&QueueName=DemoQueue
&RegionId=cn-hangzhou
&VirtualHost=test
&<Common request parameters>

Sample success responses

XML format

<CreateQueueResponse>
        <RequestId>59B52E2C-0B8E-44EC-A314-D0314A50***</RequestId>
</CreateQueueResponse>

JSON format

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

Error codes

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