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 Message Queue for RabbitMQ instance.

QueueName String Yes DemoQueue

The name of the queue to be created.

  • The 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 another queue.
RegionId String Yes cn-hangzhou

The ID of the region where you want to create the queue.

VirtualHost String Yes test

The name of the vhost.

AutoDeleteState Boolean No false

Specifies whether to enable automatic deletion. Valid values:

  • true: enables automatic deletion. The queue is automatically deleted after the last subscription from consumers to this queue is canceled.
  • false: disables automatic deletion.
ExclusiveState Boolean No false

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

  • true: The queue is an exclusive queue. Only the connection that declares the exclusive queue can use 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 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, in milliseconds. For example, if the message TTL of the queue is 1,000 ms, 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 the specified period of time, the queue is automatically deleted.

MaxLength Long No 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.

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 the 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. The value must be 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.

Examples

Sample requests

http(s)://[Endpoint]/?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.