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

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesCreateBinding

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

CreateBinding.

ArgumentStringYesx-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.

BindingKeyStringYes.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, hyphens (-), underscores (_), periods (.), forward slashes (/), and at signs (@).
    • 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, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • If the binding key contains a number sign (#), the number sign must be used together with a period (.). The binding key must start with a number sign followed by a period (#.)and end with a period followed by a number sign(.#).
    • The binding key must be 1 to 255 characters in length.
BindingTypeStringYes0

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
DestinationNameStringYesDemoQueue

The name of the object that you want to bind to the source exchange. The object must be created in the console.

InstanceIdStringYesamqp-cn-v0h1kb9nu***

The ID of the instance.

RegionIdStringYescn-hangzhou

The ID of the region.

SourceExchangeStringYesNormalEX

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

VirtualHostStringYestest

The name of the vhost. The vhost must be created in the console.

Response parameters

ParameterTypeExampleDescription
RequestIdString09768C14-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.