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

语法

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

属性

属性名称 类型 必须 允许更新 描述 约束
InstanceId String Topic所在的实例ID。
Topic String Topic的名称。 长度为3~64个字符,不能以CIDGID开头。可包含英文字母、数字、短划线(-)和下划线(_)。

如果Topic所在的实例有命名空间,则Topic的名称需要保证实例内唯一,不能和本实例下已有的Topic名称或Group ID重复;跨实例之间可以重名。

如果Topic所在的实例无命名空间,则Topic的名称需要保证跨实例和跨地域全局唯一,全局范围内不能和已有的Topic名称或Group ID重复。

Remark String Topic的描述信息。
MessageType Integer Topic的消息类型。 取值:
  • 0:普通消息。
  • 1:分区顺序消息。
  • 2:全局顺序消息。
  • 4:事务消息。
  • 5:定时和延时消息。

返回值

Fn::GetAtt

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

示例

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "Topic": {
      "Type": "ALIYUN::ROCKETMQ::Topic",
      "Properties": {
        "InstanceId": {
          "Ref": "InstanceId"
        },
        "Topic": {
          "Ref": "Topic"
        },
        "Remark": {
          "Ref": "Remark"
        },
        "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."
    },
    "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"
        ]
      }
    }
  }
}

更多示例,请参见创建标准版实例、创建客户端Group ID和创建Topic的组合示例:JSON示例YAML示例