Adding a Binding
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
|
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
|
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
|
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
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.