ALIYUN::MNS::Subscription is used to subscribe an endpoint to an Alibaba Cloud Message Service (MNS) topic. For a subscription to be created, the owner of the endpoint must confirm the subscription.

Syntax

{
  "Type": "ALIYUN::MNS::Subscription",
  "Properties": {
    "Endpoint": String,
    "NotifyStrategy": String,
    "FilterTag": String,
    "NotifyContentFormat": String,
    "SubscriptionName": String,
    "TopicName": String
  }
}

Properties

PropertyTypeRequiredEditableDescriptionConstraint
TopicNameString Yes NoThe name of the topic.

The topic name must be unique within an Alibaba Cloud account in a region.

The name can be up to 256 characters in length and can contain letters, digits, and hyphens (-). It must start with a letter.

SubscriptionNameString Yes NoThe name of the subscription. The name can be up to 256 characters in length and can contain letters, digits, and hyphens (-). It must start with a letter.
EndpointString Yes NoThe endpoint that the subscriber uses to receive messages. Valid values:
  • HttpEndpoint: This type of endpoints must be prefixed with http://.
  • QueueEndpoint: This type of endpoints must be in the acs:mns:{REGION}:{AccountID}:queues/{QueueName} format.
  • MailEndpoint: This type of endpoints must be in the mail:directmail:{MailAddress} format.
  • SmsEndpoint: This type of endpoints must be in the sms:directsms:anonymous or sms:directsms:{Phone} format.
FilterTagString No NoThe message filtering tag in the subscription. The parameter value can be up to 16 characters in length. By default, no messages are filtered.
Note Only messages that have consistent tags are pushed.
NotifyStrategyString No Yes The retry policy that is applied when an error occurs when message is delivered to the endpoint. Default value: BACKOFF_RETRY. Valid values:
  • BACKOFF_RETRY
  • EXPONENTIAL_DECAY_RETRY
NotifyContentFormatString No NoThe format of the message content pushed to the endpoint. Default value: XML. Valid values:
  • XML
  • JSON
  • SIMPLIFIED

Response parameters

Fn::GetAtt

  • SubscriptionUrl: the URL of the created subscription.
  • SubscriptionName: the name of the subscription.
  • TopicName: the name of the topic.

Examples

  • YAMLformat

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters: {}
    Resources:
      Subscription:
        Type: ALIYUN::MNS::Subscription
        Properties:
          TopicName: TestTopic
          SubscriptionName: TestSubscription
          Endpoint: http://endpoint.com
    Outputs:
      SubscriptionUrl:
        Description: URL of created subscription
        Value:
          Fn::GetAtt:
            - Subscription
            - SubscriptionUrl
      SubscriptionName:
        Description: Subscription name
        Value:
          Fn::GetAtt:
            - Subscription
            - SubscriptionName
      TopicName:
        Description: Topic name
        Value:
          Fn::GetAtt:
            - Subscription
            - TopicName
  • JSONformat

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
      },
      "Resources": {
        "Subscription": {
          "Type": "ALIYUN::MNS::Subscription",
          "Properties": {
            "TopicName": "TestTopic",
            "SubscriptionName": "TestSubscription",
            "Endpoint": "http://endpoint.com"
          }
        }
      },
      "Outputs": {
        "SubscriptionUrl": {
          "Description": "URL of created subscription",
          "Value": {
            "Fn::GetAtt": [
              "Subscription",
              "SubscriptionUrl"
            ]
          }
        },
        "SubscriptionName": {
          "Description": "Subscription name",
          "Value": {
            "Fn::GetAtt": [
              "Subscription",
              "SubscriptionName"
            ]
          }
        },
        "TopicName": {
          "Description": "Topic name",
          "Value": {
            "Fn::GetAtt": [
              "Subscription",
              "TopicName"
            ]
          }
        }
      }
    }

For more examples, visit Subscription.json and Subscription.yml. In the examples, the ALIYUN::MNS::Topic, ALIYUN::MNS::Queue, and ALIYUN::MNS::Subscription resource types are involved.