Creates a binding to bind a queue or an exchange to a specified exchange.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateBinding

The operation that you want to perform. Set the value to

CreateBinding.

Argument String Yes x-match:all;type:report;format:pdf

The key-value pairs that are configured for the headers attributes of a message. One or more key-value pairs can be concatenated to configure the headers attributes of a message. The x-match attribute must be set to one of the following valid values. Other attributes can be customized. Valid values of the x-match attribute:

  • all: A headers exchange routes a message to a queue only if all binding attributes of the queue except for x-match match the headers attributes of the message. This value is the default value.
  • any: A headers exchange routes a message to a queue if one or more binding attributes of the queue except for x-match match the headers attributes of the message.

Separate the attributes with semicolons (;), and separate the key and value of an attribute with a colon (:). An example is x-match:all;type:report;format:pdf.

This parameter applies only to headers exchanges. You can set this parameter to an arbitrary value for other types of exchanges.

BindingKey String Yes .test

The binding key.

  • If the source exchange is not a topic exchange, configure the binding key based on the following requirements:
    • The binding key can contain only letters, digits, and the following special characters: -_./@
    • The binding key must be 1 to 255 characters in length.
  • If the source exchange is a topic exchange, configure the binding key based on the following requirements:
    • The binding key can contain letters, digits, and the following special characters: -_.#/@
    • The binding key cannot start or end with a period (.). If the binding key starts with a number sign (#) or an asterisk (*), a period (.) must be specified after the number sign (#) or asterisk (*). If the binding key ends with a number sign (#) or an asterisk (*), a period (.) must be specified before the number sign (#) or asterisk (*). If the binding key does not start or end with a number sign (#) or an asterisk (*), the key must start with a period (.) and end with a period (.).
    • The binding key must be 1 to 255 characters in length.
BindingType String Yes 0

The type of the object that you want to bind to the source exchange. Valid values:

  • 0: binds a queue to the source exchange
  • 1: binds an exchange to the source exchange
DestinationName String Yes DemoQueue

The name of the object that you want to bind to the source exchange.

The object must be created in the console. The vhost of the object is the same as the vhost to which the source exchange specified by the SourceExchange parameter belongs. The vhost of the source exchange is the value of the VirtualHost parameter.

InstanceId String Yes amqp-cn-v0h1kb9nu***

The ID of the instance.

RegionId String Yes cn-hangzhou

The ID of the region.

SourceExchange String Yes NormalEX

The name of the source exchange. The source exchange must be created in the console.

VirtualHost String Yes test

The name of the vhost.

This vhost must be created in the console. The object specified by the DestinationName parameter and the source exchange specified by the SourceExchange parameter belong to the vhost.

Response parameters

Parameter Type Example Description
RequestId String 09768C14-E51C-4F4A-8077-30810032C***

The ID of the request.

Examples

Sample requests

http(s)://amqp-open.cn-hangzhou.aliyuncs.com/?Action=CreateBinding
&Argument=x-match:all;type:report;format:pdf 
&BindingKey=.test
&BindingType=0
&DestinationName=DemoQueue
&InstanceId=amqp-cn-v0h1kb9nu***
&RegionId=cn-hangzhou
&SourceExchange=NormalEX
&VirtualHost=test
&<Common request parameters>

Sample success responses

XML format

<CreateBindingResponse>
      <RequestId>09768C14-E51C-4F4A-8077-30810032C***</RequestId>
</CreateBindingResponse>

JSON format

{
    "RequestId":"09768C14-E51C-4F4A-8077-30810032C***"
}

Error codes

For a list of error codes, visit the API Error Center.