ALIYUN::ROCKETMQ::Topic

更新时间:
复制 MD 格式

The ALIYUN::ROCKETMQ::Topic resource type creates a topic.

Syntax

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

Properties

Property nameTypeRequiredUpdate allowedDescriptionConstraints
InstanceIdStringYesNoThe ID of the instance that contains the topic.None
TopicStringYesNoThe name of the topic.The name must be 3 to 64 characters in length. It cannot start with CID or GID. It can contain letters, digits, hyphens (-), and underscores (_).

If the instance that contains the topic has a namespace, the topic name must be unique within the instance. The name cannot be the same as an existing topic name or Group ID in the instance. Topic names can be the same across different instances.

If the instance that contains the topic does not have a namespace, the topic name must be globally unique across all instances and regions. The name cannot be the same as any existing topic name or Group ID.

RemarkStringNoNoThe description of the topic.None
MessageTypeIntegerYesNoThe message type of the topic.Valid values:
  • 0: Normal message.
  • 1: Partitionally ordered message.
  • 2: Globally ordered message.
  • 4: Transactional message.
  • 5: Scheduled and delayed message.

Return values

Fn::GetAtt

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

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      InstanceId:
        Type: String
        Description: The ID of the instance.
    Resources:
      Topic:
        Type: ALIYUN::ROCKETMQ::Topic
        Properties:
          InstanceId:
            Ref: InstanceId
          Topic: test-topic
          MessageType: 0
    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 message type.
        Value:
          Fn::GetAtt:
            - Topic
            - MessageType
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "InstanceId": {
          "Type": "String",
          "Description": "The ID of the instance."
        }
      },
      "Resources": {
        "Topic": {
          "Type": "ALIYUN::ROCKETMQ::Topic",
          "Properties": {
            "InstanceId": {
              "Ref": "InstanceId"
            },
            "Topic": "test-topic",
            "MessageType": 0
          }
        }
      },
      "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 message type.",
          "Value": {
            "Fn::GetAtt": [
              "Topic",
              "MessageType"
            ]
          }
        }
      }
    }

For examples of how to create a standard instance, a Group ID, and a topic, see the JSON example and YAML example.