All Products
Search
Document Center

ApsaraMQ for RabbitMQ:CreateBinding

Last Updated:Nov 25, 2024

Creates a binding. In ApsaraMQ for RabbitMQ, after a producer sends a message to an exchange, the exchange routes the message to a queue or another exchange based on the binding relationship and the routing rule.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
amqp:GetExchangecreate
*Queue
acs:amqp:{#regionId}:{#accountId}:/instances/{#InstanceId}/vhosts/{#vhostName}/queues/*
    none
  • amqp:CreateExchange
  • amqp:CreateQueue
  • amqp:GetVhost

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the ApsaraMQ for RabbitMQ instance.

amqp-cn-v0h1kb9nu***
VirtualHoststringYes

The virtual host (vhost) name. You must create the vhost in the ApsaraMQ for RabbitMQ console in advance. The object specified by DestinationName and the source exchange specified by SourceExchange must belong to the vhost.

test
SourceExchangestringYes

The name of the source exchange. You must create the source exchange in the ApsaraMQ for RabbitMQ console in advance.

NormalEX
DestinationNamestringYes

The name of the object that you want to bind to the source exchange. You must create the object in the ApsaraMQ for RabbitMQ console in advance. The vhost of the object is the same as the vhost to which the source exchange specified by SourceExchange belongs. The vhost of the source exchange is the one specified by VirtualHost.

DemoQueue
BindingKeystringYes

The binding key.

  • If the source exchange is not a topic exchange, the binding key must meet the following conventions:

    • 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, the binding key must meet the following conventions:

    • The binding key can contain letters, digits, hyphens (-), underscores (_), asterisks (*), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • The binding key cannot start or end with a period (.). If a binding key starts with a number sign (#) or an asterisk (*), the number sign (#) or asterisk (*) must be followed by a period (.). If the binding key ends with a number sign (#) or an asterisk (*), the number sign (#) or asterisk (*) must be preceded by a period (.). If a number sign (#) or an asterisk (*) is used in the middle of a binding key, the number sign (#) or asterisk (*) must be preceded and followed by a period (.).
    • The binding key must be 1 to 255 characters in length.
.test
BindingTypestringYes

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

  • **0: **Queue
  • **1: **Exchange
0
ArgumentstringYes

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. You must specify the x-match attribute as one of the valid values. You can specify custom values for other attributes. 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 (;). Separate the key and value of an attribute with a colon (:). Example: x-match:all;type:report;format:pdf. This parameter is available for only headers exchanges. You can set this parameter to an arbitrary value for other types of exchanges.

x-match:all;type:report;format:pdf

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

09768C14-E51C-4F4A-8077-30810032C***

Examples

Sample success responses

JSONformat

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

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-11-12The internal configuration of the API is changed, but the call is not affectedView Change Details