Distributed Message Service RabbitMQ

Create a Queue

2024-06-27 06:48:31

Interface Protocol

Interface

https://[endpoint].ctapi.ctyun.cn/v1/queue/create

Request Method

POST

Request Parameters

Required or Not

Parameter Type

Description

prodInstId

Yes

String

Instance ID

vhost

Yes

String

vhost name

name

Yes

String

Queue Name

durable

No

Boolean

Persistence or Not

auto_delete

No

Boolean

Whether to delete automatically

node

No

String

Select the node where the data is stored

arguments

No

String


Response Parameter

Parameter Type

Description

statusCode

String

The status code of the interface on the system layer.   Success: 800; failure: 900.

message

String

Status Description

returnObj

String

Return the object. The parameters included in this   parameter are described in the comments in Response Examples.

For arguments, please refer to the following table, format: {x-message-ttl: 123, x-overflow: "reject-publish", x-queue-mode: "lazy",…}

Parameter Name

Parameter Type

Description

x-message-ttl

Integer

Message expiration time: number type (unit: ms)

x-expires

Integer

Queue expiration time (automatically deleted after the   queue is expired: number type (unit: ms))

x-max-length

Integer

Maximum number of messages that can be stored in a queue:   number type (unit: number)

x-max-length-bytes

Integer

Maximum number of messages that can be stored in a queue:   number type (unit: byte)

x-overflow

Single choice (drop-head\reject-publish)

Message receiving policy after the maximum limit of the   queue is exceeded. drop-head: Delete the header message, which is generally   the earliest message sent, to ensure queue availability. reject-publish:   Refuse to receive new messages to ensure that messages are not lost.

x-dead-letter-exchangeh

String

Name of Dead Letter Exchange

x-dead-letter-routing-key

String

Dead Letter Routing Key

x-max-priority

Integer

Maximum queue priority: To enable the priority of a   message, you must set the priority of the queue that contains the message

x-queue-mode

Single choice (default\lazy)

Queue lazy modes: default: default value and ordinary   queue. lazy: indicates a lazy queue. Messages are saved to disks as much as   possible, resulting in a large number I/O operations, and little memory   consumption. (It is recommended for scenarios with a large accumulation of   persistent messages)

x-queue-master-locator

Single choice (client-local\min-masters\random)

Queue save location: client-local: nodes used for connection   during queue creation. min-masters: Node with the smallest number of active   nodes in the cluster. random: Randomly specify a node by the RabbitMQ server.

Sample Request

`POST https://[endpoint].ctapi.ctyun.cn/v1/queue/create`

Return Example

(1) Example of successful response

{

    "returnObj": {"data": null },

    "message": "success",

    "statusCode": "800"

}

(2) Example of failed response

{

    "returnObj": { "data": "{\"error\":\"not_found\",\"reason\":\"vhost_not_found\"}"},

    "message": "404 Not Found",

    "statusCode": "900"

}



jHEu2_EDkoJv