ALIYUN::AMQP::Binding类型用于为Exchange绑定目标对象Queue或Exchange。

语法

{
  "Type": "ALIYUN::AMQP::Binding",
  "Properties": {
    "Argument": String,
    "SourceExchange": String,
    "InstanceId": String,
    "BindingKey": String,
    "BindingType": String,
    "DestinationName": String,
    "VirtualHost": String
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
Argument String 设置消息头属性键值对信息。 消息头属性使用一个或多个键值对拼接而成。x-match属性必须配置,其余属性支持自定义。

x-match属性取值如下:

  • all:默认值,所有消息头的键值对必须匹配。
  • any:至少一对消息头的键值对必须匹配。
属性之间使用半角分号(;)隔开,属性键与值之间使用半角冒号(:)区分。例如:x-match:all;type:report;format:pdf参数仅适用于Headers Exchange,对其它类型的Exchange无效。
SourceExchange String 源Exchange名称。
InstanceId String 实例ID。
BindingKey String 绑定键。 绑定源Exchange为非Topic类型:
  • 只能包含字母、数字、短划线(-)、下划线(_)、半角句号(.)、正斜线(/)、at符号(@)。
  • 长度限制为1~255字符。
绑定源Exchange为Topic类型:
  • 可以包含字母、数字、短划线(-)、下划线(_)、星号(*)、半角句号(.)、井号(#)、正斜线(/)、at符号(@)。
  • 不能以半角句号(.)开头或结尾。对于井号(#)或星号(*),如果以其开头,则其后需有半角句号(.),如果以其结尾,则其前需有半角句号(.),如果既不是开头也不是结尾,则其前后均需有半角句号(.)。
  • 长度限制为1~255字符。
BindingType String 绑定目标对象的类型。 取值:
  • 0:Queue。
  • 1:Exchange。
DestinationName String 绑定目标名称。 绑定目标需在控制台创建且所属的Vhost与SourceExchange所属Vhost一致,即在VirtualHost中。
VirtualHost String Vhost名称。 Vhost已在控制台创建且是DestinationName和SourceExchange所属的Vhost。

返回值

Fn::GetAtt

示例

  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "Argument": {
          "Type": "String",
          "Description": "X-match Attributes. Valid Values:\n\"x-match:all\": Default Value, All the Message Header of Key-Value Pairs Stored in the Must Match.\n\"x-match:any\": at Least One Pair of the Message Header of Key-Value Pairs Stored in the Must Match."
        },
        "SourceExchange": {
          "Type": "String",
          "Description": "The Source Exchange Name."
        },
        "InstanceId": {
          "Type": "String",
          "Description": "InstanceId"
        },
        "BindingKey": {
          "Type": "String",
          "Description": "The Binding Key."
        },
        "BindingType": {
          "Type": "String",
          "Description": "The Target Binding Types. Valid values: EXCHANGE, QUEUE.",
          "AllowedValues": [
            0,
            "0",
            "QUEUE",
            1,
            "1",
            "EXCHANGE"
          ]
        },
        "DestinationName": {
          "Type": "String",
          "Description": "The Target Queue Or Exchange of the Name."
        },
        "VirtualHost": {
          "Type": "String",
          "Description": "The name of the virtual host."
        }
      },
      "Resources": {
        "Binding": {
          "Type": "ALIYUN::AMQP::Binding",
          "Properties": {
            "Argument": {
              "Ref": "Argument"
            },
            "SourceExchange": {
              "Ref": "SourceExchange"
            },
            "InstanceId": {
              "Ref": "InstanceId"
            },
            "BindingKey": {
              "Ref": "BindingKey"
            },
            "BindingType": {
              "Ref": "BindingType"
            },
            "DestinationName": {
              "Ref": "DestinationName"
            },
            "VirtualHost": {
              "Ref": "VirtualHost"
            }
          }
        }
      }
    }
  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      Argument:
        Description: 'X-match Attributes. Valid Values:
    
          "x-match:all": Default Value, All the Message Header of Key-Value Pairs Stored
          in the Must Match.
    
          "x-match:any": at Least One Pair of the Message Header of Key-Value Pairs Stored
          in the Must Match.'
        Type: String
      BindingKey:
        Description: The Binding Key.
        Type: String
      BindingType:
        AllowedValues:
        - 0
        - '0'
        - QUEUE
        - 1
        - '1'
        - EXCHANGE
        Description: 'The Target Binding Types. Valid values: EXCHANGE, QUEUE.'
        Type: String
      DestinationName:
        Description: The Target Queue Or Exchange of the Name.
        Type: String
      InstanceId:
        Description: InstanceId
        Type: String
      SourceExchange:
        Description: The Source Exchange Name.
        Type: String
      VirtualHost:
        Description: The name of the virtual host.
        Type: String
    Resources:
      Binding:
        Properties:
          Argument:
            Ref: Argument
          BindingKey:
            Ref: BindingKey
          BindingType:
            Ref: BindingType
          DestinationName:
            Ref: DestinationName
          InstanceId:
            Ref: InstanceId
          SourceExchange:
            Ref: SourceExchange
          VirtualHost:
            Ref: VirtualHost
        Type: ALIYUN::AMQP::Binding