ALIYUN::ROCKETMQ::Topic类型用于创建Topic。

语法

{
  "Type": "ALIYUN::ROCKETMQ::Topic",
  "Properties": {
    "InstanceId": String,
    "Topic": String,
    "Remark": String,
    "MessageType": Integer,
    "Perm": Integer
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
InstanceId String 需创建的Topic所对应的实例ID
Topic String 需创建的Topic的名称 CIDGID是Group ID的保留字段。Topic名称不能以CIDGID开头,能够以满足要求的任意字符开头。

Topic名称只能包含英文、数字、 短横线(-)和下划线(_),长度为3~64个字符。

  • 如果创建Topic所在的实例有名称空间,则新建的Topic名称只需确保实例内唯一,跨实例之间可重名。
  • 如果新建的Topic所在的实例没有名称空间,则新建的Topic名称需保证跨实例和跨地域全局唯一。
Remark String 备注
MessageType Integer 消息类型 取值范围:
  • 0:普通消息
  • 1:分区顺序消息
  • 2:全局顺序消息
  • 4:事务消息
  • 5:定时/延时消息
Perm Integer 订阅/发布权限 取值范围:
  • 2:可以发布
  • 4:可以订阅
  • 6:可以发布和订阅

返回值

Fn::GetAtt

  • InstanceId:Topic对应的实例ID。
  • Topic:Topic名称。
  • MessageType:消息类型。

示例

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "Topic": {
      "Type": "ALIYUN::ROCKETMQ::Topic",
      "Properties": {
        "InstanceId": {
          "Ref": "InstanceId"
        },
        "Topic": {
          "Ref": "Topic"
        },
        "Remark": {
          "Ref": "Remark"
        },
        "Perm": {
          "Ref": "Perm"
        },
        "MessageType": {
          "Ref": "MessageType"
        }
      }
    }
  },
  "Parameters": {
    "InstanceId": {
      "Type": "String",
      "Description": "The ID of the instance."
    },
    "Topic": {
      "Type": "String",
      "Description": "The name of the topic you want to create.\nNote:\n\"CID\" and \"GID\" are the reserved fields of a group ID, and they cannot be the start of a topic name.\nIf namespaces are available in the instance for which the topic is created, the topic name must be unique in the instance and can be duplicated across instances.\nIf no namespaces are available in the instance, the topic name must be unique both in the instance and across instances."
    },
    "Remark": {
      "Type": "String",
      "Description": "The remarks on the request. This parameter can be left blank."
    },
    "Perm": {
      "Type": "Number",
      "Description": "Set the read-write mode for the topic Valid values.:\n6: Both read and write operations are supported.\n4: Write operation is prohibited.\n2: Read operation is prohibited.",
      "AllowedValues": [
        2,
        4,
        6
      ]
    },
    "MessageType": {
      "Type": "Number",
      "Description": "The type of the message. Valid values:\n0: normal message\n1: partitionally ordered message\n2: globally ordered message\n4: transactional message\n5: scheduled/delayed message",
      "AllowedValues": [
        0,
        1,
        2,
        4,
        5
      ]
    }
  },
  "Outputs": {
    "InstanceId": {
      "Description": "The ID of the instance.",
      "Value": {
        "Fn::GetAtt": [
          "Topic",
          "InstanceId"
        ]
      }
    },
    "Topic": {
      "Description": "The name of the topic.",
      "Value": {
        "Fn::GetAtt": [
          "Topic",
          "Topic"
        ]
      }
    },
    "MessageType": {
      "Description": "The type of the message.",
      "Value": {
        "Fn::GetAtt": [
          "Topic",
          "MessageType"
        ]
      }
    }
  }
}

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Resources:
  Topic:
    Type: 'ALIYUN::ROCKETMQ::Topic'
    Properties:
      InstanceId:
        Ref: InstanceId
      Topic:
        Ref: Topic
      Remark:
        Ref: Remark
      Perm:
        Ref: Perm
      MessageType:
        Ref: MessageType
Parameters:
  InstanceId:
    Type: String
    Description: The ID of the instance.
  Topic:
    Type: String
    Description: >-
      The name of the topic you want to create.

      Note:

      "CID" and "GID" are the reserved fields of a group ID, and they cannot be
      the start of a topic name.

      If namespaces are available in the instance for which the topic is
      created, the topic name must be unique in the instance and can be
      duplicated across instances.

      If no namespaces are available in the instance, the topic name must be
      unique both in the instance and across instances.
  Remark:
    Type: String
    Description: The remarks on the request. This parameter can be left blank.
  Perm:
    Type: Number
    Description: |-
      Set the read-write mode for the topic Valid values.:
      6: Both read and write operations are supported.
      4: Write operation is prohibited.
      2: Read operation is prohibited.
    AllowedValues:
      - 2
      - 4
      - 6
  MessageType:
    Type: Number
    Description: |-
      The type of the message. Valid values:
      0: normal message
      1: partitionally ordered message
      2: globally ordered message
      4: transactional message
      5: scheduled/delayed message
    AllowedValues:
      - 0
      - 1
      - 2
      - 4
      - 5
Outputs:
  InstanceId:
    Description: The ID of the instance.
    Value:
      'Fn::GetAtt':
        - Topic
        - InstanceId
  Topic:
    Description: The name of the topic.
    Value:
      'Fn::GetAtt':
        - Topic
        - Topic
  MessageType:
    Description: The type of the message.
    Value:
      'Fn::GetAtt':
        - Topic
        - MessageType