ALIYUN::ROCKETMQ::Topic is used to create a Topic.

Syntax

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

Properties

Parameter Data type Required Editable Description Constraint
InstanceId String Yes No The ID of the instance corresponding to the topic that you want to create. N/A
Topics String Yes No The name of the Topic that you want to create. CID and GID is a reserved field of a Group ID. Topic Name cannot start with CID or GID which can start with any character that meets the requirement.

The Topic name must be 3 to 64 characters in length and can contain letters, digits, hyphen (-), and underscores (_).

  • 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 namespace is available in the instance, the name of the Topic must be unique across instances and regions.
Remark String No No Remarks N/A
MessageType Integer Yes No Message Type Valid values:
  • 0: Normal message.
  • 1: Partitionally ordered message.
  • 2: Globally ordered message.
  • 4: Transactional message.
  • 5: Scheduled or delayed message.
Perm Integer No Yes Subscribe /publish permissions Valid values:
  • 2: can be published
  • 4: Can subscribe
  • 6: can publish and subscribe

Error code

Fn::GetAtt

  • InstanceId: The instance ID of the Topic.
  • Topic: The name of the Topic.
  • MessageType: The message type.

Examples

JSON format

{
  "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 format

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 and 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