Adding a Binding

Updated on 2025-03-26 GMT+08:00

Function

This API is used to add a binding.

Calling Method

For details, see Calling APIs.

URI

POST /v2/rabbitmq/{project_id}/instances/{instance_id}/vhosts/{vhost}/exchanges/{exchange}/binding

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

instance_id

Yes

String

Instance ID.

vhost

Yes

String

Virtual host name.

exchange

Yes

String

Exchange name.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

destination

Yes

String

Name of a target exchange or queue.

routing_key

Yes

String

Binding key-value. This parameter informs the exchange of which queues or exchanges to deliver messages to.

destination_type

Yes

String

Type of the binding target. The options are Exchange and Queue.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

source

String

Binding source.

destination_type

String

Type of the binding target. The options are Exchange or Queue.

destination

String

Name of a target exchange or queue.

routing_key

String

Binding key-value. This parameter informs the exchange of which queues to deliver messages to.

Example Requests

Binding test-exchange to a Queue target named mirror-queue with routing key routing_key_1

POST /v2/rabbitmq/{project_id}/instances/{instance_id}/vhosts/default/exchanges/test-exchange/binding

{
  "destination_type" : "Queue",
  "destination" : "mirror-queue",
  "routing_key" : "routing_key_1"
}

Example Responses

Status code: 200

Successful

{
  "source" : "exchange_name",
  "destination_type" : "Queue",
  "destination" : "queue_name",
  "routing_key" : "binding_key_demo"
}

Status Codes

Status Code

Description

200

Successful

Error Codes

See Error Codes.

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback