DATASOURCE::MNS::Topics is used to query topics.

Syntax

{
  "Type": "DATASOURCE::MNS::Topics",
  "Properties": {
    "TopicName": String
  }
}

Properties

Property Type Required Editable Description Constraint
TopicName String No Yes The name of the Message Service (MNS) topic. None.

Return values (Fn::GetAtt)

Fn::GetAtt

  • TopicNames: the names of the topics.
  • Topics: details of the topics.
Property Type Description Constraint
TopicNames List The names of the topics. None.
Topics List Details of the topics. None.
TopicName String The name of the MNS topic. The topic name must be unique within your Alibaba Cloud account in the specified region. The name can be up to 256 characters in length and can contain letters, digits, and hyphens (-). The name must start with a letter.
MessageCount Number The number of messages in the topic. None.
MaxMessageSize Number The maximum size of a message body that is sent to the topic. Valid values: 1024 (1 KB) to 65536 (64 KB).

Default value: 65536 (64 KB).

Unit: bytes.

MessageRetentionPeriod Number The retention period of the message in the topic. When the specified retention period ends, the message is deleted regardless of whether the message is pushed to the subscribers.

Unit: seconds.

CreateTime String The time when the topic was created. The timestamp follows the UNIX time format. It is the number of seconds that have elapsed since 00:00:00 Thursday, January 1, 1970.
LastModifyTime String The time when the topic was last modified. The timestamp follows the UNIX time format. It is the number of seconds that have elapsed since 00:00:00 Thursday, January 1, 1970.
LoggingEnabled Boolean Indicates whether the log management feature is enabled for the topic. Default value: false. Valid values:
  • true: The log management feature is enabled.
  • false: The log management feature is disabled.

Examples

  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "TopicName": {
          "Type": "String",
          "Description": "Topic name."
        }
      },
      "Resources": {
        "Topics": {
          "Type": "DATASOURCE::MNS::Topics",
          "Properties": {
            "TopicName": {
              "Ref": "TopicName"
            }
          }
        }
      },
      "Outputs": {
        "Topics": {
          "Description": "The list of topics.",
          "Value": {
            "Fn::GetAtt": [
              "Topics",
              "Topics"
            ]
          }
        },
        "TopicNames": {
          "Description": "The list of topic names.",
          "Value": {
            "Fn::GetAtt": [
              "Topics",
              "TopicNames"
            ]
          }
        }
      }
    }
  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      TopicName:
        Type: String
        Description: Topic name.
    Resources:
      Topics:
        Type: DATASOURCE::MNS::Topics
        Properties:
          TopicName:
            Ref: TopicName
    Outputs:
      Topics:
        Description: The list of topics.
        Value:
          Fn::GetAtt:
            - Topics
            - Topics
      TopicNames:
        Description: The list of topic names.
        Value:
          Fn::GetAtt:
            - Topics
            - TopicNames