添加绑定
功能介绍
添加绑定。
URI
POST /v2/rabbitmq/{project_id}/instances/{instance_id}/vhosts/{vhost}/exchanges/{exchange}/binding
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
project_id |
是 |
String |
项目ID,获取方式请参见获取项目ID。 |
|
instance_id |
是 |
String |
实例ID |
|
vhost |
是 |
String |
Vhost名称 |
|
exchange |
是 |
String |
Exchange名称 |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
destination |
是 |
String |
要投递的Exchange或Queue名称 |
|
routing_key |
是 |
String |
绑定键值,用于告知Exchange应该将消息投递到哪些Queue或Exchange中 |
|
destination_type |
是 |
String |
绑定目标端类型,Exchange或Queue。 |
响应参数
状态码:200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
source |
String |
绑定对象 |
|
destination_type |
String |
绑定Exchange或者Queue |
|
destination |
String |
要投递的Exchange或Queue名称 |
|
routing_key |
String |
绑定键值,用于告知Exchange应该将消息投递到哪些Queue中 |
请求示例
将test-exchange作为源端,与目标端为Queue类型的mirror-queue绑定,绑定路由键为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"
}
响应示例
状态码:200
添加绑定成功
{
"source" : "exchange_name",
"destination_type" : "Queue",
"destination" : "queue_name",
"routing_key" : "binding_key_demo"
}
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
添加绑定成功 |
错误码
请参见错误码。