All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::MNS::Subscription

Last Updated:Jun 03, 2025

ALIYUN::MNS::Subscription is used to describe a subscription relationship, including the subscribed topic and the endpoint that the subscriber uses to receive messages.

Syntax

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

Properties

Property

Type

Required

Editable

Description

Constraint

TopicName

String

Yes

No

The 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.

SubscriptionName

String

Yes

No

The 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.

Endpoint

String

Yes

No

The 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.

FilterTag

String

No

No

The message filtering tag in the subscription.

The tag can be up to 16 characters in length. By default, no messages are filtered.

Note

Only messages that have the same tag are pushed.

NotifyStrategy

String

No

Yes

The retry policy that is applied when an error occurs when message is delivered to the endpoint.

Valid values:

  • BACKOFF_RETRY (default)

  • EXPONENTIAL_DECAY_RETRY

NotifyContentFormat

String

No

No

The format of the message content pushed to the endpoint.

Valid values:

  • XML (default)

  • JSON

  • SIMPLIFIED

DlqPolicy

Map

No

Yes

The dead-letter policy.

For more information, see the "DlqPolicy properties" section of this topic.

PushType

String

No

No

The terminal type.

Valid values

  • http: HTTP service.

  • queue: queue.

  • mpush: mobile device.

  • alisms: Alibaba Cloud Short Message Service (SMS).

  • email: email.

DlqPolicy syntax

"DlqPolicy": {
  "DeadLetterTargetQueue": String,
  "Enabled": Boolean
}

DlqPolicy properties

Property

Type

Required

Editable

Description

Constraint

DeadLetterTargetQueue

String

Yes

Yes

The queue to deliver dead-letter messages.

None.

Enabled

Boolean

Yes

Yes

Specifies whether to enable dead-letter message delivery.

None.

Return values

Fn::GetAtt

  • SubscriptionUrl: the URL of the created subscription.

  • SubscriptionName: the name of the created subscription.

  • TopicName: the name of the topic.

Examples

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
{
  "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.yml. In the examples, the ALIYUN::MNS::Topic, ALIYUN::MNS::Queue, and ALIYUN::MNS::Subscription resource types are used.