All Products
Search
Document Center

ApsaraMQ for RabbitMQ:CreateQueue

Last Updated:Sep 12, 2024

Creates a queue. In ApsaraMQ for RabbitMQ, a queue is a message queue. All messages in ApsaraMQ for RabbitMQ are sent to a specific exchange and then routed to a bound queue by the exchange.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
amqp:CreateQueuecreate
  • Queue
    acs:amqp:{#regionId}:{#accountId}:/instances/{#instanceId}/vhosts/{#vhostName}/queues/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the ApsaraMQ for RabbitMQ instance on which you want to create a queue.

amqp-cn-v0h1kb9nu***
VirtualHoststringYes

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

test
QueueNamestringYes

The name of the queue that you want to create.

  • The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
  • After the queue is created, you cannot change the name of the queue. If you want to change the name of the queue, delete the queue and create another queue.
DemoQueue
AutoDeleteStatebooleanNo

Specifies whether to automatically delete the queue. Valid values:

  • true: The queue is automatically deleted. After the last consumer unsubscribes from the queue, the queue is automatically deleted.
  • false: The queue is not automatically deleted.
false
ExclusiveStatebooleanNo

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.
false
MessageTTLlongNo

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 is 1,000 milliseconds, the message can be retained for up to 1 second in the queue.
1000
AutoExpireStatelongNo

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 enable the feature, submit a ticket.
10000
MaxLengthlongNo

This parameter is unavailable in the current version of ApsaraMQ for RabbitMQ.

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

1000
DeadLetterExchangestringNo

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

If a consumer rejects a message that cannot be redelivered, ApsaraMQ for RabbitMQ routes the message 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 for storage.

DLExchange
DeadLetterRoutingKeystringNo

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

test.dl
MaximumPriorityintegerNo

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

10

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

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

Examples

Sample success responses

JSONformat

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

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history