All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::DATAHUB::Topic

Last Updated:May 17, 2023

ALIYUN::DATAHUB::Topic is used to create a topic.

Alibaba Cloud allows you to create topics in the following regions:

  • China (Hangzhou)

  • China (Shanghai)

  • China (Beijing)

  • China (Zhangjiakou)

  • China (Shenzhen)

  • Singapore (Singapore)

  • Malaysia (Kuala Lumpur)

  • Germany (Frankfurt)

  • India (Mumbai)

Syntax

{
  "Type": "ALIYUN::DATAHUB::Topic",
  "Properties": {
    "Comment": String,
    "RecordType": String,
    "ProjectName": String,
    "RecordSchema": String,
    "TopicName": String,
    "ShardCount": Integer,
    "Lifecycle": Integer
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

Comment

String

Yes

No

The description of the topic.

The description must be 3 to 1,024 characters in length.

RecordType

String

Yes

No

The type of the topic.

Valid values:

  • TUPLE: structured data

  • BLOB: unstructured data

ProjectName

String

Yes

No

The name of the project.

None.

RecordSchema

String

No

No

Details of the schema of the topic.

This property must be specified when you create a topic of the TUPLE type. This property cannot be specified when you create a topic of the BLOB type.

TopicName

String

Yes

No

The name of the topic.

The name must be 3 to 64 characters in length and can contain digits, letters, and underscores (_). The name is case-sensitive and must start with a letter.

ShardCount

Integer

No

No

The initial number of shards in the topic.

None.

Lifecycle

Integer

No

No

The time to live (TTL) period of data.

None.

Return values

Fn::GetAtt

  • ProjectName: the name of the project.

  • TopicName: the name of the topic.

Examples

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Description: Test DataHub Topic
Parameters:
  RecordType:
    Type: String
    Default: BLOB
    AllowedValues:
      - TUPLE
      - BLOB
  ProjectName:
    Type: String
    Default: mytest
  TopicName:
    Type: String
    Default: mytest
Resources:
  Topic:
    Type: ALIYUN::DATAHUB::Topic
    Properties:
      Comment: Test Create Topic
      RecordType:
        Ref: RecordType
      ProjectName:
        Ref: ProjectName
      TopicName:
        Ref: TopicName
Outputs:
  ProjectName:
    Value:
      Fn::GetAtt:
        - Topic
        - ProjectName
  TopicName:
    Value:
      Fn::GetAtt:
        - Topic
        - TopicName

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Test DataHub Topic",
  "Parameters": {
    "RecordType": {
      "Type": "String",
      "Default": "BLOB",
      "AllowedValues": [
        "TUPLE",
        "BLOB"
      ]
    },
    "ProjectName": {
      "Type": "String",
      "Default": "mytest"
    },
    "TopicName": {
      "Type": "String",
      "Default": "mytest"
    }
  },
  "Resources": {
    "Topic": {
      "Type": "ALIYUN::DATAHUB::Topic",
      "Properties": {
        "Comment": "Test Create Topic",
        "RecordType": {
          "Ref": "RecordType"
        },
        "ProjectName": {
          "Ref": "ProjectName"
        },
        "TopicName": {
          "Ref": "TopicName"
        }
      }
    }
  },
  "Outputs": {
    "ProjectName": {
      "Value": {
        "Fn::GetAtt": [
          "Topic",
          "ProjectName"
        ]
      }
    },
    "TopicName": {
      "Value": {
        "Fn::GetAtt": [
          "Topic",
          "TopicName"
        ]
      }
    }
  }
}