Function
This API is used to create a queue.
URI
PUT /v2/rabbitmq/{project_id}/instances/{instance_id}/vhosts/{vhost}/queues
Table 1 Path Parameters | Parameter | Mandatory | Type | Description |
| project_id | Yes | String | Project ID. For details, see Obtaining a Project ID. |
| instance_id | Yes | String | Instance ID. |
| vhost | Yes | String | Virtual host name. If the name contains a slash (/), replace it with __F_SLASH__. Otherwise, the calling fails. For example, if the virtual host name is /test, the input parameter is __F_SLASH__test. |
Request Parameters
Table 2 Request body parameters | Parameter | Mandatory | Type | Description |
| name | Yes | String | Definition Queue name. Constraints -
The value can only include letters, digits, periods (.), percent signs (%), vertical bars (|), hyphens (-), underscores (_), and slashes (/). -
Version 3.x.x: The range is 2 to 128 characters. -
Version AMQP-0-9-1: The range is 2 to 64 characters. When calculating the length of a queue name for an AMQP-0-9-1 instance, each special character (period, percent sign, vertical bar, and slash) counts as three characters. Range N/A Default Value N/A |
| auto_delete | Yes | Boolean | Indicates whether to enable automatic deletion. |
| durable | No | Boolean | Indicates whether to enable data persistence (The AMQP version does not have this field because data persistence is enabled by default). |
| dead_letter_exchange | No | String | Name of the dead letter exchange. Rejected and expired messages are re-sent to this exchange. |
| dead_letter_routing_key | No | String | Routing key of the dead letter exchange. The dead letter exchange sends dead letter messages to the queue with a matching routing key. |
| message_ttl | No | Long | Indicates for how long a message in this queue can be retained. |
| lazy_mode | No | String | To make this queue lazy, enter lazy. Lazy queues store more messages on disk and save memory. If this parameter is not set, messages are stored in memory and delivered quickly. (AMQP stores messages to disks by default. This field is not involved.) |
Response Parameters
Status code: 200
Table 3 Response body parameters | Parameter | Type | Description |
| name | String | Definition Queue name. Constraints -
The value can only include letters, digits, periods (.), percent signs (%), vertical bars (|), hyphens (-), underscores (_), and slashes (/). -
Version 3.x.x: The range is 2 to 128 characters. -
Version AMQP-0-9-1: The range is 2 to 64 characters. When calculating the length of a queue name for an AMQP-0-9-1 instance, each special character (period, percent sign, vertical bar, and slash) counts as three characters. Range N/A Default Value N/A |
| auto_delete | Boolean | Indicates whether to enable automatic deletion. |
| durable | Boolean | Indicates whether to enable data persistence (The AMQP version does not have this field because data persistence is enabled by default). |
| dead_letter_exchange | String | Name of the dead letter exchange. Rejected and expired messages are re-sent to this exchange. |
| dead_letter_routing_key | String | Routing key of the dead letter exchange. The dead letter exchange sends dead letter messages to the queue with a matching routing key. |
| message_ttl | Long | Indicates for how long a message in this queue can be retained. |
| lazy_mode | String | To make this queue lazy, enter lazy. Lazy queues store more messages on disk and save memory. If this parameter is not set, messages are stored in memory and delivered quickly. (AMQP stores messages to disks by default. This field is not involved.) |
Example Requests
Creating a queue
PUT https://{endpoint}/v2/rabbitmq/{project_id}/instances/{instance_id}/vhosts/{vhost}/queues
{
"name" : "string",
"auto_delete" : true,
"durable" : true,
"dead_letter_exchange" : "string",
"dead_letter_routing_key" : "string",
"message_ttl" : 6000,
"lazy_mode" : "string"
} Example Responses
Status code: 200
Queue created.
{
"name" : "string",
"auto_delete" : true,
"durable" : true,
"dead_letter_exchange" : "string",
"dead_letter_routing_key" : "string",
"message_ttl" : 60000,
"lazy_mode" : "string"
} Status Codes
| Status Code | Description |
| 200 | Queue created. |