Todos os produtos
Search
Central de documentação

Resource Orchestration Service:ALIYUN::MNS::Subscription

Última atualização: Oct 10, 2026

O tipo de recurso ALIYUN::MNS::Subscription descreve uma relação de assinatura, incluindo o tópico assinado e o endpoint que recebe as mensagens.

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

Constraints

Endpoint

String

Yes

No

Endpoint que recebe as mensagens desta assinatura.

Valores válidos:

  • HttpEndpoint: Deve começar com http://.

  • QueueEndpoint: Deve seguir o formato acs:mns:{REGION}:{AccountID}:queues/{QueueName}.

  • MailEndpoint: Deve seguir o formato mail:directmail:{MailAddress}.

  • SmsEndpoint: Configure como sms:directsms:anonymous ou sms:directsms:{Phone}.

SubscriptionName

String

Yes

No

Nome da assinatura.

Pode conter até 256 caracteres. Deve começar com uma letra e aceita letras, dígitos e hífens (-).

TopicName

String

Yes

No

Nome do tópico.

Deve ser exclusivo para uma conta da Alibaba Cloud em uma região. Pode conter até 256 caracteres. Deve começar com uma letra e aceita letras, dígitos e hífens (-).

DlqPolicy

Map

No

Yes

Política de dead-letter.

Para obter mais informações, consulte DlqPolicy properties.

FilterTag

String

No

No

Tag para filtrar mensagens nesta assinatura.

Pode conter até 16 caracteres. Por padrão, o filtro não é aplicado.

Nota

Apenas mensagens com tags correspondentes são encaminhadas.

NotifyContentFormat

String

No

No

Formato das mensagens encaminhadas ao endpoint.

Valores válidos:

  • XML (padrão)

  • JSON

  • SIMPLIFIED

Para saber mais sobre os formatos de mensagem, consulte NotifyContentFormat.

NotifyStrategy

String

No

Yes

Política de nova tentativa acionada em caso de erro ao encaminhar mensagens para o endpoint.

Valores válidos:

  • BACKOFF_RETRY (padrão)

  • EXPONENTIAL_DECAY_RETRY

Para detalhes sobre as políticas de nova tentativa, consulte NotifyStrategy.

PushType

String

No

No

Tipo do endpoint.

Valores válidos:

  • http: tipo de envio HTTP.

  • queue: tipo de envio para fila.

  • mpush: tipo de envio para dispositivos móveis.

  • alisms: tipo de envio por meio do Alibaba Cloud Short Message Service (SMS).

  • email: tipo de envio por e-mail.

DlqPolicy syntax

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

DlqPolicy properties

Property

Type

Required

Editable

Description

Constraints

DeadLetterTargetQueue

String

Yes

Yes

Fila de destino para entrega de mensagens dead-letter.

Nenhuma.

Enabled

Boolean

Yes

Yes

Indica se a entrega de mensagens dead-letter está ativada.

Nenhuma.

Return values

Fn::GetAtt

  • SubscriptionUrl: URL da assinatura criada.

  • SubscriptionName: nome da assinatura.

  • TopicName: nome do tópico.

Examples

Scenario 1: Create a simple HTTP subscription for an existing topic

# Scenario 1: Create a simple HTTP subscription for an existing topic
# Create a simple HTTP subscription for an existing topic
ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: Create a simple HTTP push subscription for an existing MNS topic to push messages to a specified HTTP callback URL.
  en: Create a simple HTTP push subscription for an existing MNS topic to push messages to a specified HTTP callback URL.
Parameters:
  TopicName:
    Type: String
    Label:
      zh-cn: Topic Name
      en: Topic Name
    Description:
      zh-cn: The name of an existing MNS topic.
      en: The name of an existing MNS topic.
  SubscriptionName:
    Type: String
    Label:
      zh-cn: Subscription Name
      en: Subscription Name
    Description:
      zh-cn: The name of the subscription.
      en: The name of the subscription.
    Default: my-http-subscription
  HttpEndpoint:
    Type: String
    Label:
      zh-cn: HTTP Callback URL
      en: HTTP Callback URL
    Description:
      zh-cn: The HTTP/HTTPS callback URL to receive message push, e.g. http://example.com/callback.
      en: The HTTP/HTTPS callback URL to receive message push, e.g. http://example.com/callback.
Resources:
  Subscription:
    Type: ALIYUN::MNS::Subscription
    Properties:
      TopicName:
        Ref: TopicName
      SubscriptionName:
        Ref: SubscriptionName
      PushType: http
      Endpoint:
        Ref: HttpEndpoint
Outputs:
  SubscriptionName:
    Description:
      zh-cn: Subscription name.
      en: Subscription name.
    Label:
      zh-cn: Subscription Name
      en: Subscription Name
    Value:
      Fn::GetAtt:
        - Subscription
        - SubscriptionName
  SubscriptionUrl:
    Description:
      zh-cn: The URL of the subscription.
      en: The URL of the subscription.
    Label:
      zh-cn: Subscription URL
      en: Subscription URL
    Value:
      Fn::GetAtt:
        - Subscription
        - SubscriptionUrl
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - TopicName
          - SubscriptionName
          - HttpEndpoint
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "Create a simple HTTP push subscription for an existing MNS topic to push messages to a specified HTTP callback URL.",
    "en": "Create a simple HTTP push subscription for an existing MNS topic to push messages to a specified HTTP callback URL."
  },
  "Parameters": {
    "TopicName": {
      "Type": "String",
      "Label": {
        "zh-cn": "Topic Name",
        "en": "Topic Name"
      },
      "Description": {
        "zh-cn": "The name of an existing MNS topic.",
        "en": "The name of an existing MNS topic."
      }
    },
    "SubscriptionName": {
      "Type": "String",
      "Label": {
        "zh-cn": "Subscription Name",
        "en": "Subscription Name"
      },
      "Description": {
        "zh-cn": "The name of the subscription.",
        "en": "The name of the subscription."
      },
      "Default": "my-http-subscription"
    },
    "HttpEndpoint": {
      "Type": "String",
      "Label": {
        "zh-cn": "HTTP Callback URL",
        "en": "HTTP Callback URL"
      },
      "Description": {
        "zh-cn": "The HTTP/HTTPS callback URL to receive message push, e.g. http://example.com/callback.",
        "en": "The HTTP/HTTPS callback URL to receive message push, e.g. http://example.com/callback."
      }
    }
  },
  "Resources": {
    "Subscription": {
      "Type": "ALIYUN::MNS::Subscription",
      "Properties": {
        "TopicName": {
          "Ref": "TopicName"
        },
        "SubscriptionName": {
          "Ref": "SubscriptionName"
        },
        "PushType": "http",
        "Endpoint": {
          "Ref": "HttpEndpoint"
        }
      }
    }
  },
  "Outputs": {
    "SubscriptionName": {
      "Description": {
        "zh-cn": "Subscription name.",
        "en": "Subscription name."
      },
      "Label": {
        "zh-cn": "Subscription Name",
        "en": "Subscription Name"
      },
      "Value": {
        "Fn::GetAtt": [
          "Subscription",
          "SubscriptionName"
        ]
      }
    },
    "SubscriptionUrl": {
      "Description": {
        "zh-cn": "The URL of the subscription.",
        "en": "The URL of the subscription."
      },
      "Label": {
        "zh-cn": "Subscription URL",
        "en": "Subscription URL"
      },
      "Value": {
        "Fn::GetAtt": [
          "Subscription",
          "SubscriptionUrl"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "TopicName",
            "SubscriptionName",
            "HttpEndpoint"
          ]
        }
      ]
    }
  }
}

Scenario 2: Create a topic and a queue, and create a queue-push subscription with message tag filtering

# Scenario 2: Create a topic and a queue, and create a queue-push subscription with message tag filtering
# Create a topic and a queue, then create a queue-push subscription with message tag filtering
ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: Create an MNS topic and a subscriber queue, create a queue-push subscription with FilterTag-based message filtering so that only messages with matching tags are pushed to the queue.
  en: Create an MNS topic and a subscriber queue, create a queue-push subscription with FilterTag-based message filtering so that only messages with matching tags are pushed to the queue.
Parameters:
  CommonName:
    Type: String
    Label:
      zh-cn: Resource Name Prefix
      en: Resource Name Prefix
    Description:
      zh-cn: Unified name prefix for all resources.
      en: Unified name prefix for all resources.
    Default: filtered-sub
  FilterTag:
    Type: String
    Label:
      zh-cn: Message Filter Tag
      en: Message Filter Tag
    Description:
      zh-cn: The message filter tag, up to 16 characters. Only messages with matching tags are pushed.
      en: The message filter tag, up to 16 characters. Only messages with matching tags are pushed.
    Default: important
    MaxLength: 16
Resources:
  Topic:
    Type: ALIYUN::MNS::Topic
    Properties:
      TopicName:
        Fn::Sub: ${CommonName}-topic
      LoggingEnabled: true
  SubscriberQueue:
    Type: ALIYUN::MNS::Queue
    Properties:
      QueueName:
        Fn::Sub: ${CommonName}-queue
      MessageRetentionPeriod: 345600
      VisibilityTimeout: 30
      PollingWaitSeconds: 10
      LoggingEnabled: true
  Subscription:
    Type: ALIYUN::MNS::Subscription
    DependsOn:
      - Topic
      - SubscriberQueue
    Properties:
      TopicName:
        Fn::GetAtt:
          - Topic
          - TopicName
      SubscriptionName:
        Fn::Sub: ${CommonName}-sub
      PushType: queue
      Endpoint:
        Fn::Sub:
          - acs:mns:${ALIYUN::Region}:${ALIYUN::TenantId}:queues/${QueueName}
          - QueueName:
              Fn::GetAtt:
                - SubscriberQueue
                - QueueName
      FilterTag:
        Ref: FilterTag
      NotifyContentFormat: JSON
      NotifyStrategy: BACKOFF_RETRY
Outputs:
  TopicName:
    Description:
      zh-cn: Topic name.
      en: Topic name.
    Label:
      zh-cn: Topic Name
      en: Topic Name
    Value:
      Fn::GetAtt:
        - Topic
        - TopicName
  QueueUrl:
    Description:
      zh-cn: The URL of the subscriber queue.
      en: The URL of the subscriber queue.
    Label:
      zh-cn: Queue URL
      en: Queue URL
    Value:
      Fn::GetAtt:
        - SubscriberQueue
        - QueueUrl
  SubscriptionUrl:
    Description:
      zh-cn: The URL of the subscription.
      en: The URL of the subscription.
    Label:
      zh-cn: Subscription URL
      en: Subscription URL
    Value:
      Fn::GetAtt:
        - Subscription
        - SubscriptionUrl
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - CommonName
          - FilterTag
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "Create an MNS topic and a subscriber queue, create a queue-push subscription with FilterTag-based message filtering so that only messages with matching tags are pushed to the queue.",
    "en": "Create an MNS topic and a subscriber queue, create a queue-push subscription with FilterTag-based message filtering so that only messages with matching tags are pushed to the queue."
  },
  "Parameters": {
    "CommonName": {
      "Type": "String",
      "Label": {
        "zh-cn": "Resource Name Prefix",
        "en": "Resource Name Prefix"
      },
      "Description": {
        "zh-cn": "Unified name prefix for all resources.",
        "en": "Unified name prefix for all resources."
      },
      "Default": "filtered-sub"
    },
    "FilterTag": {
      "Type": "String",
      "Label": {
        "zh-cn": "Message Filter Tag",
        "en": "Message Filter Tag"
      },
      "Description": {
        "zh-cn": "The message filter tag, up to 16 characters. Only messages with matching tags are pushed.",
        "en": "The message filter tag, up to 16 characters. Only messages with matching tags are pushed."
      },
      "Default": "important",
      "MaxLength": 16
    }
  },
  "Resources": {
    "Topic": {
      "Type": "ALIYUN::MNS::Topic",
      "Properties": {
        "TopicName": {
          "Fn::Sub": "${CommonName}-topic"
        },
        "LoggingEnabled": true
      }
    },
    "SubscriberQueue": {
      "Type": "ALIYUN::MNS::Queue",
      "Properties": {
        "QueueName": {
          "Fn::Sub": "${CommonName}-queue"
        },
        "MessageRetentionPeriod": 345600,
        "VisibilityTimeout": 30,
        "PollingWaitSeconds": 10,
        "LoggingEnabled": true
      }
    },
    "Subscription": {
      "Type": "ALIYUN::MNS::Subscription",
      "DependsOn": [
        "Topic",
        "SubscriberQueue"
      ],
      "Properties": {
        "TopicName": {
          "Fn::GetAtt": [
            "Topic",
            "TopicName"
          ]
        },
        "SubscriptionName": {
          "Fn::Sub": "${CommonName}-sub"
        },
        "PushType": "queue",
        "Endpoint": {
          "Fn::Sub": [
            "acs:mns:${ALIYUN::Region}:${ALIYUN::TenantId}:queues/${QueueName}",
            {
              "QueueName": {
                "Fn::GetAtt": [
                  "SubscriberQueue",
                  "QueueName"
                ]
              }
            }
          ]
        },
        "FilterTag": {
          "Ref": "FilterTag"
        },
        "NotifyContentFormat": "JSON",
        "NotifyStrategy": "BACKOFF_RETRY"
      }
    }
  },
  "Outputs": {
    "TopicName": {
      "Description": {
        "zh-cn": "Topic name.",
        "en": "Topic name."
      },
      "Label": {
        "zh-cn": "Topic Name",
        "en": "Topic Name"
      },
      "Value": {
        "Fn::GetAtt": [
          "Topic",
          "TopicName"
        ]
      }
    },
    "QueueUrl": {
      "Description": {
        "zh-cn": "The URL of the subscriber queue.",
        "en": "The URL of the subscriber queue."
      },
      "Label": {
        "zh-cn": "Queue URL",
        "en": "Queue URL"
      },
      "Value": {
        "Fn::GetAtt": [
          "SubscriberQueue",
          "QueueUrl"
        ]
      }
    },
    "SubscriptionUrl": {
      "Description": {
        "zh-cn": "The URL of the subscription.",
        "en": "The URL of the subscription."
      },
      "Label": {
        "zh-cn": "Subscription URL",
        "en": "Subscription URL"
      },
      "Value": {
        "Fn::GetAtt": [
          "Subscription",
          "SubscriptionUrl"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "CommonName",
            "FilterTag"
          ]
        }
      ]
    }
  }
}

Scenario 3: Create queue and HTTP subscriptions for a topic with dead-letter and retry policies

# Scenario 3: Create subscriptions with multiple push types (queue and HTTP) for a topic, and configure dead-letter and retry policies to provide multichannel message delivery and failure fallback
# Create multiple push-type subscriptions (queue + HTTP) for a topic with DLQ and retry policies for multi-channel message delivery with failure fallback
ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: Create an MNS topic with a complete multi-channel subscription system including two queue subscriptions filtered by business tags with different retry strategies and one HTTP subscription pushing to a business callback, all with DLQ policies so failed messages go to a unified dead letter queue for reliable multi-channel delivery.
  en: Create an MNS topic with a complete multi-channel subscription system including two queue subscriptions filtered by business tags with different retry strategies and one HTTP subscription pushing to a business callback, all with DLQ policies so failed messages go to a unified dead letter queue for reliable multi-channel delivery.
Parameters:
  CommonName:
    Type: String
    Label:
      zh-cn: Resource Name Prefix
      en: Resource Name Prefix
    Description:
      zh-cn: Unified name prefix for all resources.
      en: Unified name prefix for all resources.
    Default: multi-channel
  HttpCallbackEndpoint:
    Type: String
    Label:
      zh-cn: HTTP Callback URL
      en: HTTP Callback URL
    Description:
      zh-cn: The HTTP/HTTPS callback URL to receive message push.
      en: The HTTP/HTTPS callback URL to receive message push.
    Default: http://example.com/mns/callback
  MaxReceiveCount:
    Type: Number
    Label:
      zh-cn: Max Receive Count
      en: Max Receive Count
    Description:
      zh-cn: The maximum number of times that a message can be received before it is delivered to the dead-letter queue.
      en: The maximum number of times a message can be received before being moved to the dead letter queue.
    Default: 3
    MinValue: 1
Resources:
  Topic:
    Type: ALIYUN::MNS::Topic
    Properties:
      TopicName:
        Fn::Sub: ${CommonName}-topic
      MaximumMessageSize: 65536
      LoggingEnabled: true
      Tags:
        - Key: Architecture
          Value: MultiChannel
        - Key: CreatedBy
          Value: ROS
  DeadLetterQueue:
    Type: ALIYUN::MNS::Queue
    Properties:
      QueueName:
        Fn::Sub: ${CommonName}-dlq
      MessageRetentionPeriod: 604800
      LoggingEnabled: true
      Tags:
        - Key: QueueType
          Value: DeadLetter
  UrgentQueue:
    Type: ALIYUN::MNS::Queue
    Properties:
      QueueName:
        Fn::Sub: ${CommonName}-urgent-queue
      VisibilityTimeout: 30
      PollingWaitSeconds: 5
      LoggingEnabled: true
      DlqPolicy:
        Enabled: true
        DeadLetterTargetQueue:
          Fn::Sub: ${CommonName}-dlq
        MaxReceiveCount:
          Ref: MaxReceiveCount
      Tags:
        - Key: Channel
          Value: Urgent
  NormalQueue:
    Type: ALIYUN::MNS::Queue
    Properties:
      QueueName:
        Fn::Sub: ${CommonName}-normal-queue
      VisibilityTimeout: 60
      PollingWaitSeconds: 15
      LoggingEnabled: true
      DlqPolicy:
        Enabled: true
        DeadLetterTargetQueue:
          Fn::Sub: ${CommonName}-dlq
        MaxReceiveCount:
          Ref: MaxReceiveCount
      Tags:
        - Key: Channel
          Value: Normal
  UrgentSubscription:
    Type: ALIYUN::MNS::Subscription
    DependsOn:
      - Topic
      - UrgentQueue
    Properties:
      TopicName:
        Fn::GetAtt:
          - Topic
          - TopicName
      SubscriptionName:
        Fn::Sub: ${CommonName}-urgent-sub
      PushType: queue
      Endpoint:
        Fn::Sub:
          - acs:mns:${ALIYUN::Region}:${ALIYUN::TenantId}:queues/${QueueName}
          - QueueName:
              Fn::GetAtt:
                - UrgentQueue
                - QueueName
      FilterTag: urgent
      NotifyContentFormat: JSON
      NotifyStrategy: EXPONENTIAL_DECAY_RETRY
      DlqPolicy:
        Enabled: true
        DeadLetterTargetQueue:
          Fn::Sub: ${CommonName}-dlq
  NormalSubscription:
    Type: ALIYUN::MNS::Subscription
    DependsOn:
      - Topic
      - NormalQueue
    Properties:
      TopicName:
        Fn::GetAtt:
          - Topic
          - TopicName
      SubscriptionName:
        Fn::Sub: ${CommonName}-normal-sub
      PushType: queue
      Endpoint:
        Fn::Sub:
          - acs:mns:${ALIYUN::Region}:${ALIYUN::TenantId}:queues/${QueueName}
          - QueueName:
              Fn::GetAtt:
                - NormalQueue
                - QueueName
      FilterTag: normal
      NotifyContentFormat: JSON
      NotifyStrategy: BACKOFF_RETRY
      DlqPolicy:
        Enabled: true
        DeadLetterTargetQueue:
          Fn::Sub: ${CommonName}-dlq
  HttpSubscription:
    Type: ALIYUN::MNS::Subscription
    DependsOn: Topic
    Properties:
      TopicName:
        Fn::GetAtt:
          - Topic
          - TopicName
      SubscriptionName:
        Fn::Sub: ${CommonName}-http-sub
      PushType: http
      Endpoint:
        Ref: HttpCallbackEndpoint
      NotifyContentFormat: JSON
      NotifyStrategy: EXPONENTIAL_DECAY_RETRY
      DlqPolicy:
        Enabled: true
        DeadLetterTargetQueue:
          Fn::Sub: ${CommonName}-dlq
Outputs:
  TopicUrl:
    Description:
      zh-cn: Topic URL.
      en: Topic URL.
    Label:
      zh-cn: Topic URL
      en: Topic URL
    Value:
      Fn::GetAtt:
        - Topic
        - TopicUrl
  UrgentQueueUrl:
    Description:
      zh-cn: Urgent message queue URL.
      en: Urgent message queue URL.
    Label:
      zh-cn: Urgent Queue URL
      en: Urgent Queue URL
    Value:
      Fn::GetAtt:
        - UrgentQueue
        - QueueUrl
  NormalQueueUrl:
    Description:
      zh-cn: Normal message queue URL.
      en: Normal message queue URL.
    Label:
      zh-cn: Normal Queue URL
      en: Normal Queue URL
    Value:
      Fn::GetAtt:
        - NormalQueue
        - QueueUrl
  HttpSubscriptionUrl:
    Description:
      zh-cn: HTTP subscription URL.
      en: HTTP subscription URL.
    Label:
      zh-cn: HTTP Subscription URL
      en: HTTP Subscription URL
    Value:
      Fn::GetAtt:
        - HttpSubscription
        - SubscriptionUrl
  DeadLetterQueueUrl:
    Description:
      zh-cn: Dead-letter queue URL.
      en: Dead letter queue URL.
    Label:
      zh-cn: DLQ URL
      en: DLQ URL
    Value:
      Fn::GetAtt:
        - DeadLetterQueue
        - QueueUrl
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - CommonName
          - HttpCallbackEndpoint
          - MaxReceiveCount
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "Create an MNS topic and a complete multichannel subscription system, including two queue subscriptions filtered by business tags with different retry policies and one HTTP subscription that pushes messages to a business callback. Configure dead-letter policies for all subscriptions so failed messages are delivered to a dead-letter queue, enabling reliable multichannel message delivery.",
    "en": "Create an MNS topic with a complete multi-channel subscription system including two queue subscriptions filtered by business tags with different retry strategies and one HTTP subscription pushing to a business callback, all with DLQ policies so failed messages go to a unified dead letter queue for reliable multi-channel delivery."
  },
  "Parameters": {
    "CommonName": {
      "Type": "String",
      "Label": {
        "zh-cn": "Resource Name Prefix",
        "en": "Resource Name Prefix"
      },
      "Description": {
        "zh-cn": "Unified name prefix for all resources.",
        "en": "Unified name prefix for all resources."
      },
      "Default": "multi-channel"
    },
    "HttpCallbackEndpoint": {
      "Type": "String",
      "Label": {
        "zh-cn": "HTTP Callback URL",
        "en": "HTTP Callback URL"
      },
      "Description": {
        "zh-cn": "The HTTP/HTTPS callback URL to receive message push.",
        "en": "The HTTP/HTTPS callback URL to receive message push."
      },
      "Default": "http://example.com/mns/callback"
    },
    "MaxReceiveCount": {
      "Type": "Number",
      "Label": {
        "zh-cn": "Max Receive Count",
        "en": "Max Receive Count"
      },
      "Description": {
        "zh-cn": "The maximum number of times a message can be received before being moved to the dead letter queue.",
        "en": "The maximum number of times a message can be received before being moved to the dead letter queue."
      },
      "Default": 3,
      "MinValue": 1
    }
  },
  "Resources": {
    "Topic": {
      "Type": "ALIYUN::MNS::Topic",
      "Properties": {
        "TopicName": {
          "Fn::Sub": "${CommonName}-topic"
        },
        "MaximumMessageSize": 65536,
        "LoggingEnabled": true,
        "Tags": [
          {
            "Key": "Architecture",
            "Value": "MultiChannel"
          },
          {
            "Key": "CreatedBy",
            "Value": "ROS"
          }
        ]
      }
    },
    "DeadLetterQueue": {
      "Type": "ALIYUN::MNS::Queue",
      "Properties": {
        "QueueName": {
          "Fn::Sub": "${CommonName}-dlq"
        },
        "MessageRetentionPeriod": 604800,
        "LoggingEnabled": true,
        "Tags": [
          {
            "Key": "QueueType",
            "Value": "DeadLetter"
          }
        ]
      }
    },
    "UrgentQueue": {
      "Type": "ALIYUN::MNS::Queue",
      "Properties": {
        "QueueName": {
          "Fn::Sub": "${CommonName}-urgent-queue"
        },
        "VisibilityTimeout": 30,
        "PollingWaitSeconds": 5,
        "LoggingEnabled": true,
        "DlqPolicy": {
          "Enabled": true,
          "DeadLetterTargetQueue": {
            "Fn::Sub": "${CommonName}-dlq"
          },
          "MaxReceiveCount": {
            "Ref": "MaxReceiveCount"
          }
        },
        "Tags": [
          {
            "Key": "Channel",
            "Value": "Urgent"
          }
        ]
      }
    },
    "NormalQueue": {
      "Type": "ALIYUN::MNS::Queue",
      "Properties": {
        "QueueName": {
          "Fn::Sub": "${CommonName}-normal-queue"
        },
        "VisibilityTimeout": 60,
        "PollingWaitSeconds": 15,
        "LoggingEnabled": true,
        "DlqPolicy": {
          "Enabled": true,
          "DeadLetterTargetQueue": {
            "Fn::Sub": "${CommonName}-dlq"
          },
          "MaxReceiveCount": {
            "Ref": "MaxReceiveCount"
          }
        },
        "Tags": [
          {
            "Key": "Channel",
            "Value": "Normal"
          }
        ]
      }
    },
    "UrgentSubscription": {
      "Type": "ALIYUN::MNS::Subscription",
      "DependsOn": [
        "Topic",
        "UrgentQueue"
      ],
      "Properties": {
        "TopicName": {
          "Fn::GetAtt": [
            "Topic",
            "TopicName"
          ]
        },
        "SubscriptionName": {
          "Fn::Sub": "${CommonName}-urgent-sub"
        },
        "PushType": "queue",
        "Endpoint": {
          "Fn::Sub": [
            "acs:mns:${ALIYUN::Region}:${ALIYUN::TenantId}:queues/${QueueName}",
            {
              "QueueName": {
                "Fn::GetAtt": [
                  "UrgentQueue",
                  "QueueName"
                ]
              }
            }
          ]
        },
        "FilterTag": "urgent",
        "NotifyContentFormat": "JSON",
        "NotifyStrategy": "EXPONENTIAL_DECAY_RETRY",
        "DlqPolicy": {
          "Enabled": true,
          "DeadLetterTargetQueue": {
            "Fn::Sub": "${CommonName}-dlq"
          }
        }
      }
    },
    "NormalSubscription": {
      "Type": "ALIYUN::MNS::Subscription",
      "DependsOn": [
        "Topic",
        "NormalQueue"
      ],
      "Properties": {
        "TopicName": {
          "Fn::GetAtt": [
            "Topic",
            "TopicName"
          ]
        },
        "SubscriptionName": {
          "Fn::Sub": "${CommonName}-normal-sub"
        },
        "PushType": "queue",
        "Endpoint": {
          "Fn::Sub": [
            "acs:mns:${ALIYUN::Region}:${ALIYUN::TenantId}:queues/${QueueName}",
            {
              "QueueName": {
                "Fn::GetAtt": [
                  "NormalQueue",
                  "QueueName"
                ]
              }
            }
          ]
        },
        "FilterTag": "normal",
        "NotifyContentFormat": "JSON",
        "NotifyStrategy": "BACKOFF_RETRY",
        "DlqPolicy": {
          "Enabled": true,
          "DeadLetterTargetQueue": {
            "Fn::Sub": "${CommonName}-dlq"
          }
        }
      }
    },
    "HttpSubscription": {
      "Type": "ALIYUN::MNS::Subscription",
      "DependsOn": "Topic",
      "Properties": {
        "TopicName": {
          "Fn::GetAtt": [
            "Topic",
            "TopicName"
          ]
        },
        "SubscriptionName": {
          "Fn::Sub": "${CommonName}-http-sub"
        },
        "PushType": "http",
        "Endpoint": {
          "Ref": "HttpCallbackEndpoint"
        },
        "NotifyContentFormat": "JSON",
        "NotifyStrategy": "EXPONENTIAL_DECAY_RETRY",
        "DlqPolicy": {
          "Enabled": true,
          "DeadLetterTargetQueue": {
            "Fn::Sub": "${CommonName}-dlq"
          }
        }
      }
    }
  },
  "Outputs": {
    "TopicUrl": {
      "Description": {
        "zh-cn": "Topic URL.",
        "en": "Topic URL."
      },
      "Label": {
        "zh-cn": "Topic URL",
        "en": "Topic URL"
      },
      "Value": {
        "Fn::GetAtt": [
          "Topic",
          "TopicUrl"
        ]
      }
    },
    "UrgentQueueUrl": {
      "Description": {
        "zh-cn": "Urgent message queue URL.",
        "en": "Urgent message queue URL."
      },
      "Label": {
        "zh-cn": "Urgent Queue URL",
        "en": "Urgent Queue URL"
      },
      "Value": {
        "Fn::GetAtt": [
          "UrgentQueue",
          "QueueUrl"
        ]
      }
    },
    "NormalQueueUrl": {
      "Description": {
        "zh-cn": "Normal message queue URL.",
        "en": "Normal message queue URL."
      },
      "Label": {
        "zh-cn": "Normal Queue URL",
        "en": "Normal Queue URL"
      },
      "Value": {
        "Fn::GetAtt": [
          "NormalQueue",
          "QueueUrl"
        ]
      }
    },
    "HttpSubscriptionUrl": {
      "Description": {
        "zh-cn": "HTTP subscription URL.",
        "en": "HTTP subscription URL."
      },
      "Label": {
        "zh-cn": "HTTP Subscription URL",
        "en": "HTTP Subscription URL"
      },
      "Value": {
        "Fn::GetAtt": [
          "HttpSubscription",
          "SubscriptionUrl"
        ]
      }
    },
    "DeadLetterQueueUrl": {
      "Description": {
        "zh-cn": "Dead-letter queue URL.",
        "en": "Dead letter queue URL."
      },
      "Label": {
        "zh-cn": "DLQ URL",
        "en": "DLQ URL"
      },
      "Value": {
        "Fn::GetAtt": [
          "DeadLetterQueue",
          "QueueUrl"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "CommonName",
            "HttpCallbackEndpoint",
            "MaxReceiveCount"
          ]
        }
      ]
    }
  }
}