Todos os produtos
Search
Central de documentação

Resource Orchestration Service:ALIYUN::MNS::Topic

Última atualização: Oct 09, 2026

Crie um tópico com o recurso ALIYUN::MNS::Topic.

Sintaxe

{
  "Type": "ALIYUN::MNS::Topic",
  "Properties": {
    "LoggingEnabled": Boolean,
    "TopicName": String,
    "MaximumMessageSize": Integer,
    "Tags": List
  }
}

Propriedades

Propriedade

Tipo

Obrigatório

Editável

Descrição

Restrições

TopicName

String

Sim

Não

Nome do tópico.

O nome deve ser exclusivo na mesma conta e região.

Aceita até 256 caracteres, deve começar com uma letra e pode incluir letras, dígitos e hífens (-).

LoggingEnabled

Boolean

Não

Sim

Ativa ou desativa o gerenciamento de logs.

Valor padrão: false. Valores válidos:

  • true: ativa o gerenciamento de logs.

  • false: desativa o gerenciamento de logs.

MaximumMessageSize

Integer

Não

Sim

Tamanho máximo do corpo da mensagem enviada ao tópico.

Valores válidos: 1024 (1 KB) a 65536 (64 KB).

Unidade: bytes.

Valor padrão: 65536 (64 KB).

Tags

List

Não

Não

Tags do tópico.

Para mais informações, consulte Propriedades das tags.

Sintaxe das tags

"Tags": [{
  "Key": String,
  "Value": String
}]

Propriedades das tags

Propriedade

Tipo

Obrigatório

Editável

Descrição

Restrições

Key

String

Sim

Não

Chave da tag.

Nenhuma.

Value

String

Não

Não

Valor da tag.

Nenhuma.

Valores de retorno

Fn::GetAtt

  • TopicUrl: URL do tópico criado.

  • TopicName: Nome do tópico criado.

  • ARN.WithSlash: ARN do tópico criado.

Exemplos

Cenário 1: Criar um tópico MNS

# Scenario 1: Create a simple MNS topic
# Create a simple MNS topic with default configurations
ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: Create a simple MNS topic with default configurations.
  en: Create a simple MNS topic with default configuration.
Parameters:
  TopicName:
    Type: String
    Label:
      zh-cn: Topic name
      en: Topic Name
    Description:
      zh-cn: The topic name. It must be unique within the same account and region.
      en: The topic name. Must be unique in the same account and region.
    Default: my-first-topic
    MinLength: 1
    MaxLength: 256
Resources:
  Topic:
    Type: ALIYUN::MNS::Topic
    Properties:
      TopicName:
        Ref: TopicName
Outputs:
  TopicName:
    Description:
      zh-cn: Topic name.
      en: Topic name.
    Label:
      zh-cn: Topic name
      en: Topic Name
    Value:
      Fn::GetAtt:
        - Topic
        - TopicName
  TopicUrl:
    Description:
      zh-cn: The URL of the topic.
      en: The URL of the topic.
    Label:
      zh-cn: Topic URL
      en: Topic URL
    Value:
      Fn::GetAtt:
        - Topic
        - TopicUrl
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - TopicName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "Create a simple MNS topic with default configurations.",
    "en": "Create a simple MNS topic with default configuration."
  },
  "Parameters": {
    "TopicName": {
      "Type": "String",
      "Label": {
        "zh-cn": "Topic name",
        "en": "Topic Name"
      },
      "Description": {
        "zh-cn": "The topic name. It must be unique within the same account and region.",
        "en": "The topic name. Must be unique in the same account and region."
      },
      "Default": "my-first-topic",
      "MinLength": 1,
      "MaxLength": 256
    }
  },
  "Resources": {
    "Topic": {
      "Type": "ALIYUN::MNS::Topic",
      "Properties": {
        "TopicName": {
          "Ref": "TopicName"
        }
      }
    }
  },
  "Outputs": {
    "TopicName": {
      "Description": {
        "zh-cn": "Topic name.",
        "en": "Topic name."
      },
      "Label": {
        "zh-cn": "Topic name",
        "en": "Topic Name"
      },
      "Value": {
        "Fn::GetAtt": [
          "Topic",
          "TopicName"
        ]
      }
    },
    "TopicUrl": {
      "Description": {
        "zh-cn": "The URL of the topic.",
        "en": "The URL of the topic."
      },
      "Label": {
        "zh-cn": "Topic URL",
        "en": "Topic URL"
      },
      "Value": {
        "Fn::GetAtt": [
          "Topic",
          "TopicUrl"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "TopicName"
          ]
        }
      ]
    }
  }
}

Cenário 2: Criar um tópico MNS, uma fila de assinantes e uma assinatura para publicação/assinatura de mensagens

# Scenario 2: Create an MNS topic, a subscriber queue, and a subscription for message publish/subscribe
# Create an MNS topic, a subscriber queue and a subscription for message publish/subscribe
ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: Create an MNS topic and a subscriber queue, and create a subscription from the topic to the queue to push messages from the topic to the queue.
  en: Create an MNS topic and a subscriber queue, then create a subscription from the topic to the queue for message push.
Parameters:
  CommonName:
    Type: String
    Label:
      zh-cn: Resource name prefix
      en: Resource Name Prefix
    Description:
      zh-cn: The unified name prefix for all resources.
      en: Unified name prefix for all resources.
    Default: pubsub-demo
  LoggingEnabled:
    Type: Boolean
    Label:
      zh-cn: Enable logging
      en: Enable Logging
    Description:
      zh-cn: Specifies whether to enable Log Management for the topic and queue.
      en: Whether to enable log management for the topic and queue.
    Default: true
Resources:
  Topic:
    Type: ALIYUN::MNS::Topic
    Properties:
      TopicName:
        Fn::Sub: ${CommonName}-topic
      MaximumMessageSize: 65536
      LoggingEnabled:
        Ref: LoggingEnabled
      Tags:
        - Key: CreatedBy
          Value: ROS
  SubscriberQueue:
    Type: ALIYUN::MNS::Queue
    Properties:
      QueueName:
        Fn::Sub: ${CommonName}-queue
      MessageRetentionPeriod: 345600
      VisibilityTimeout: 30
      PollingWaitSeconds: 10
      LoggingEnabled:
        Ref: LoggingEnabled
      Tags:
        - Key: CreatedBy
          Value: ROS
  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
      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
  TopicUrl:
    Description:
      zh-cn: The URL of the topic.
      en: The URL of the topic.
    Label:
      zh-cn: Topic URL
      en: Topic URL
    Value:
      Fn::GetAtt:
        - Topic
        - TopicUrl
  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
          - LoggingEnabled
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "Create an MNS topic and a subscriber queue, and create a subscription from the topic to the queue to push messages from the topic to the queue.",
    "en": "Create an MNS topic and a subscriber queue, then create a subscription from the topic to the queue for message push."
  },
  "Parameters": {
    "CommonName": {
      "Type": "String",
      "Label": {
        "zh-cn": "Resource name prefix",
        "en": "Resource Name Prefix"
      },
      "Description": {
        "zh-cn": "The unified name prefix for all resources.",
        "en": "Unified name prefix for all resources."
      },
      "Default": "pubsub-demo"
    },
    "LoggingEnabled": {
      "Type": "Boolean",
      "Label": {
        "zh-cn": "Enable logging",
        "en": "Enable Logging"
      },
      "Description": {
        "zh-cn": "Specifies whether to enable Log Management for the topic and queue.",
        "en": "Whether to enable log management for the topic and queue."
      },
      "Default": true
    }
  },
  "Resources": {
    "Topic": {
      "Type": "ALIYUN::MNS::Topic",
      "Properties": {
        "TopicName": {
          "Fn::Sub": "${CommonName}-topic"
        },
        "MaximumMessageSize": 65536,
        "LoggingEnabled": {
          "Ref": "LoggingEnabled"
        },
        "Tags": [
          {
            "Key": "CreatedBy",
            "Value": "ROS"
          }
        ]
      }
    },
    "SubscriberQueue": {
      "Type": "ALIYUN::MNS::Queue",
      "Properties": {
        "QueueName": {
          "Fn::Sub": "${CommonName}-queue"
        },
        "MessageRetentionPeriod": 345600,
        "VisibilityTimeout": 30,
        "PollingWaitSeconds": 10,
        "LoggingEnabled": {
          "Ref": "LoggingEnabled"
        },
        "Tags": [
          {
            "Key": "CreatedBy",
            "Value": "ROS"
          }
        ]
      }
    },
    "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"
                ]
              }
            }
          ]
        },
        "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"
        ]
      }
    },
    "TopicUrl": {
      "Description": {
        "zh-cn": "The URL of the topic.",
        "en": "The URL of the topic."
      },
      "Label": {
        "zh-cn": "Topic URL",
        "en": "Topic URL"
      },
      "Value": {
        "Fn::GetAtt": [
          "Topic",
          "TopicUrl"
        ]
      }
    },
    "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",
            "LoggingEnabled"
          ]
        }
      ]
    }
  }
}

Cenário 3: Criar uma arquitetura orientada a eventos com múltiplos tópicos e assinaturas, agrupando tópicos por domínio de negócio e utilizando FilterTag para roteamento refinado de mensagens

# Scenario 3: Create a multi-topic, multi-subscription event-driven architecture that groups topics by business domain and uses FilterTag for refined message routing
# Create a multi-topic multi-subscription event-driven architecture with business-domain topics and FilterTag-based message routing
ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: Create a complete event-driven architecture that includes multiple MNS topics by business domain (order, inventory, and notification), multiple subscription queues filtered by message tag under each topic, and a unified dead letter queue to implement refined routing and failure fallback for e-commerce events.
  en: Create a complete event-driven architecture including multiple business-domain MNS topics (order, inventory, notification), multiple subscription queues filtered by message tags under each topic, and a unified dead letter queue for refined routing of e-commerce events with failure fallback.
Parameters:
  CommonName:
    Type: String
    Label:
      zh-cn: Resource name prefix
      en: Resource Name Prefix
    Description:
      zh-cn: The unified name prefix for all resources.
      en: Unified name prefix for all resources.
    Default: event-center
  MaxReceiveCount:
    Type: Number
    Label:
      zh-cn: Maximum receive count
      en: Max Receive Count
    Description:
      zh-cn: The maximum number of times that a message can be consumed. When exceeded, the message 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:
  OrderTopic:
    Type: ALIYUN::MNS::Topic
    Properties:
      TopicName:
        Fn::Sub: ${CommonName}-order-topic
      MaximumMessageSize: 65536
      LoggingEnabled: true
      Tags:
        - Key: Domain
          Value: Order
        - Key: CreatedBy
          Value: ROS
  InventoryTopic:
    Type: ALIYUN::MNS::Topic
    Properties:
      TopicName:
        Fn::Sub: ${CommonName}-inventory-topic
      MaximumMessageSize: 65536
      LoggingEnabled: true
      Tags:
        - Key: Domain
          Value: Inventory
        - Key: CreatedBy
          Value: ROS
  NotificationTopic:
    Type: ALIYUN::MNS::Topic
    Properties:
      TopicName:
        Fn::Sub: ${CommonName}-notification-topic
      MaximumMessageSize: 65536
      LoggingEnabled: true
      Tags:
        - Key: Domain
          Value: Notification
        - Key: CreatedBy
          Value: ROS
  DeadLetterQueue:
    Type: ALIYUN::MNS::Queue
    Properties:
      QueueName:
        Fn::Sub: ${CommonName}-dlq
      MessageRetentionPeriod: 604800
      LoggingEnabled: true
      Tags:
        - Key: QueueType
          Value: DeadLetter
  OrderCreatedQueue:
    Type: ALIYUN::MNS::Queue
    Properties:
      QueueName:
        Fn::Sub: ${CommonName}-order-created-queue
      VisibilityTimeout: 60
      PollingWaitSeconds: 10
      LoggingEnabled: true
      DlqPolicy:
        Enabled: true
        DeadLetterTargetQueue:
          Fn::Sub: ${CommonName}-dlq
        MaxReceiveCount:
          Ref: MaxReceiveCount
  OrderPaidQueue:
    Type: ALIYUN::MNS::Queue
    Properties:
      QueueName:
        Fn::Sub: ${CommonName}-order-paid-queue
      VisibilityTimeout: 60
      PollingWaitSeconds: 10
      LoggingEnabled: true
      DlqPolicy:
        Enabled: true
        DeadLetterTargetQueue:
          Fn::Sub: ${CommonName}-dlq
        MaxReceiveCount:
          Ref: MaxReceiveCount
  StockWarningQueue:
    Type: ALIYUN::MNS::Queue
    Properties:
      QueueName:
        Fn::Sub: ${CommonName}-stock-warning-queue
      VisibilityTimeout: 30
      PollingWaitSeconds: 10
      LoggingEnabled: true
      DlqPolicy:
        Enabled: true
        DeadLetterTargetQueue:
          Fn::Sub: ${CommonName}-dlq
        MaxReceiveCount:
          Ref: MaxReceiveCount
  SmsNotifyQueue:
    Type: ALIYUN::MNS::Queue
    Properties:
      QueueName:
        Fn::Sub: ${CommonName}-sms-notify-queue
      VisibilityTimeout: 30
      PollingWaitSeconds: 10
      LoggingEnabled: true
      DlqPolicy:
        Enabled: true
        DeadLetterTargetQueue:
          Fn::Sub: ${CommonName}-dlq
        MaxReceiveCount:
          Ref: MaxReceiveCount
  OrderCreatedSubscription:
    Type: ALIYUN::MNS::Subscription
    DependsOn:
      - OrderTopic
      - OrderCreatedQueue
    Properties:
      TopicName:
        Fn::GetAtt:
          - OrderTopic
          - TopicName
      SubscriptionName:
        Fn::Sub: ${CommonName}-order-created-sub
      PushType: queue
      Endpoint:
        Fn::Sub:
          - acs:mns:${ALIYUN::Region}:${ALIYUN::TenantId}:queues/${QueueName}
          - QueueName:
              Fn::GetAtt:
                - OrderCreatedQueue
                - QueueName
      FilterTag: created
      NotifyContentFormat: JSON
      NotifyStrategy: EXPONENTIAL_DECAY_RETRY
      DlqPolicy:
        Enabled: true
        DeadLetterTargetQueue:
          Fn::Sub: ${CommonName}-dlq
  OrderPaidSubscription:
    Type: ALIYUN::MNS::Subscription
    DependsOn:
      - OrderTopic
      - OrderPaidQueue
    Properties:
      TopicName:
        Fn::GetAtt:
          - OrderTopic
          - TopicName
      SubscriptionName:
        Fn::Sub: ${CommonName}-order-paid-sub
      PushType: queue
      Endpoint:
        Fn::Sub:
          - acs:mns:${ALIYUN::Region}:${ALIYUN::TenantId}:queues/${QueueName}
          - QueueName:
              Fn::GetAtt:
                - OrderPaidQueue
                - QueueName
      FilterTag: paid
      NotifyContentFormat: JSON
      NotifyStrategy: EXPONENTIAL_DECAY_RETRY
      DlqPolicy:
        Enabled: true
        DeadLetterTargetQueue:
          Fn::Sub: ${CommonName}-dlq
  StockWarningSubscription:
    Type: ALIYUN::MNS::Subscription
    DependsOn:
      - InventoryTopic
      - StockWarningQueue
    Properties:
      TopicName:
        Fn::GetAtt:
          - InventoryTopic
          - TopicName
      SubscriptionName:
        Fn::Sub: ${CommonName}-stock-warning-sub
      PushType: queue
      Endpoint:
        Fn::Sub:
          - acs:mns:${ALIYUN::Region}:${ALIYUN::TenantId}:queues/${QueueName}
          - QueueName:
              Fn::GetAtt:
                - StockWarningQueue
                - QueueName
      FilterTag: warning
      NotifyContentFormat: JSON
      NotifyStrategy: BACKOFF_RETRY
      DlqPolicy:
        Enabled: true
        DeadLetterTargetQueue:
          Fn::Sub: ${CommonName}-dlq
  SmsNotifySubscription:
    Type: ALIYUN::MNS::Subscription
    DependsOn:
      - NotificationTopic
      - SmsNotifyQueue
    Properties:
      TopicName:
        Fn::GetAtt:
          - NotificationTopic
          - TopicName
      SubscriptionName:
        Fn::Sub: ${CommonName}-sms-notify-sub
      PushType: queue
      Endpoint:
        Fn::Sub:
          - acs:mns:${ALIYUN::Region}:${ALIYUN::TenantId}:queues/${QueueName}
          - QueueName:
              Fn::GetAtt:
                - SmsNotifyQueue
                - QueueName
      FilterTag: sms
      NotifyContentFormat: JSON
      NotifyStrategy: BACKOFF_RETRY
      DlqPolicy:
        Enabled: true
        DeadLetterTargetQueue:
          Fn::Sub: ${CommonName}-dlq
Outputs:
  OrderTopicUrl:
    Description:
      zh-cn: Order topic URL.
      en: Order topic URL.
    Label:
      zh-cn: Order topic URL
      en: Order Topic URL
    Value:
      Fn::GetAtt:
        - OrderTopic
        - TopicUrl
  InventoryTopicUrl:
    Description:
      zh-cn: Inventory topic URL.
      en: Inventory topic URL.
    Label:
      zh-cn: Inventory topic URL
      en: Inventory Topic URL
    Value:
      Fn::GetAtt:
        - InventoryTopic
        - TopicUrl
  NotificationTopicUrl:
    Description:
      zh-cn: Notification topic URL.
      en: Notification topic URL.
    Label:
      zh-cn: Notification topic URL
      en: Notification Topic URL
    Value:
      Fn::GetAtt:
        - NotificationTopic
        - TopicUrl
  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
          - MaxReceiveCount
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "Create a complete event-driven architecture that includes multiple MNS topics by business domain (order, inventory, and notification), multiple subscription queues filtered by message tag under each topic, and a unified dead letter queue to implement refined routing and failure fallback for e-commerce events.",
    "en": "Create a complete event-driven architecture including multiple business-domain MNS topics (order, inventory, notification), multiple subscription queues filtered by message tags under each topic, and a unified dead letter queue for refined routing of e-commerce events with failure fallback."
  },
  "Parameters": {
    "CommonName": {
      "Type": "String",
      "Label": {
        "zh-cn": "Resource name prefix",
        "en": "Resource Name Prefix"
      },
      "Description": {
        "zh-cn": "The unified name prefix for all resources.",
        "en": "Unified name prefix for all resources."
      },
      "Default": "event-center"
    },
    "MaxReceiveCount": {
      "Type": "Number",
      "Label": {
        "zh-cn": "Maximum receive count",
        "en": "Max Receive Count"
      },
      "Description": {
        "zh-cn": "The maximum number of times that a message can be consumed. When exceeded, the message 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": {
    "OrderTopic": {
      "Type": "ALIYUN::MNS::Topic",
      "Properties": {
        "TopicName": {
          "Fn::Sub": "${CommonName}-order-topic"
        },
        "MaximumMessageSize": 65536,
        "LoggingEnabled": true,
        "Tags": [
          {
            "Key": "Domain",
            "Value": "Order"
          },
          {
            "Key": "CreatedBy",
            "Value": "ROS"
          }
        ]
      }
    },
    "InventoryTopic": {
      "Type": "ALIYUN::MNS::Topic",
      "Properties": {
        "TopicName": {
          "Fn::Sub": "${CommonName}-inventory-topic"
        },
        "MaximumMessageSize": 65536,
        "LoggingEnabled": true,
        "Tags": [
          {
            "Key": "Domain",
            "Value": "Inventory"
          },
          {
            "Key": "CreatedBy",
            "Value": "ROS"
          }
        ]
      }
    },
    "NotificationTopic": {
      "Type": "ALIYUN::MNS::Topic",
      "Properties": {
        "TopicName": {
          "Fn::Sub": "${CommonName}-notification-topic"
        },
        "MaximumMessageSize": 65536,
        "LoggingEnabled": true,
        "Tags": [
          {
            "Key": "Domain",
            "Value": "Notification"
          },
          {
            "Key": "CreatedBy",
            "Value": "ROS"
          }
        ]
      }
    },
    "DeadLetterQueue": {
      "Type": "ALIYUN::MNS::Queue",
      "Properties": {
        "QueueName": {
          "Fn::Sub": "${CommonName}-dlq"
        },
        "MessageRetentionPeriod": 604800,
        "LoggingEnabled": true,
        "Tags": [
          {
            "Key": "QueueType",
            "Value": "DeadLetter"
          }
        ]
      }
    },
    "OrderCreatedQueue": {
      "Type": "ALIYUN::MNS::Queue",
      "Properties": {
        "QueueName": {
          "Fn::Sub": "${CommonName}-order-created-queue"
        },
        "VisibilityTimeout": 60,
        "PollingWaitSeconds": 10,
        "LoggingEnabled": true,
        "DlqPolicy": {
          "Enabled": true,
          "DeadLetterTargetQueue": {
            "Fn::Sub": "${CommonName}-dlq"
          },
          "MaxReceiveCount": {
            "Ref": "MaxReceiveCount"
          }
        }
      }
    },
    "OrderPaidQueue": {
      "Type": "ALIYUN::MNS::Queue",
      "Properties": {
        "QueueName": {
          "Fn::Sub": "${CommonName}-order-paid-queue"
        },
        "VisibilityTimeout": 60,
        "PollingWaitSeconds": 10,
        "LoggingEnabled": true,
        "DlqPolicy": {
          "Enabled": true,
          "DeadLetterTargetQueue": {
            "Fn::Sub": "${CommonName}-dlq"
          },
          "MaxReceiveCount": {
            "Ref": "MaxReceiveCount"
          }
        }
      }
    },
    "StockWarningQueue": {
      "Type": "ALIYUN::MNS::Queue",
      "Properties": {
        "QueueName": {
          "Fn::Sub": "${CommonName}-stock-warning-queue"
        },
        "VisibilityTimeout": 30,
        "PollingWaitSeconds": 10,
        "LoggingEnabled": true,
        "DlqPolicy": {
          "Enabled": true,
          "DeadLetterTargetQueue": {
            "Fn::Sub": "${CommonName}-dlq"
          },
          "MaxReceiveCount": {
            "Ref": "MaxReceiveCount"
          }
        }
      }
    },
    "SmsNotifyQueue": {
      "Type": "ALIYUN::MNS::Queue",
      "Properties": {
        "QueueName": {
          "Fn::Sub": "${CommonName}-sms-notify-queue"
        },
        "VisibilityTimeout": 30,
        "PollingWaitSeconds": 10,
        "LoggingEnabled": true,
        "DlqPolicy": {
          "Enabled": true,
          "DeadLetterTargetQueue": {
            "Fn::Sub": "${CommonName}-dlq"
          },
          "MaxReceiveCount": {
            "Ref": "MaxReceiveCount"
          }
        }
      }
    },
    "OrderCreatedSubscription": {
      "Type": "ALIYUN::MNS::Subscription",
      "DependsOn": [
        "OrderTopic",
        "OrderCreatedQueue"
      ],
      "Properties": {
        "TopicName": {
          "Fn::GetAtt": [
            "OrderTopic",
            "TopicName"
          ]
        },
        "SubscriptionName": {
          "Fn::Sub": "${CommonName}-order-created-sub"
        },
        "PushType": "queue",
        "Endpoint": {
          "Fn::Sub": [
            "acs:mns:${ALIYUN::Region}:${ALIYUN::TenantId}:queues/${QueueName}",
            {
              "QueueName": {
                "Fn::GetAtt": [
                  "OrderCreatedQueue",
                  "QueueName"
                ]
              }
            }
          ]
        },
        "FilterTag": "created",
        "NotifyContentFormat": "JSON",
        "NotifyStrategy": "EXPONENTIAL_DECAY_RETRY",
        "DlqPolicy": {
          "Enabled": true,
          "DeadLetterTargetQueue": {
            "Fn::Sub": "${CommonName}-dlq"
          }
        }
      }
    },
    "OrderPaidSubscription": {
      "Type": "ALIYUN::MNS::Subscription",
      "DependsOn": [
        "OrderTopic",
        "OrderPaidQueue"
      ],
      "Properties": {
        "TopicName": {
          "Fn::GetAtt": [
            "OrderTopic",
            "TopicName"
          ]
        },
        "SubscriptionName": {
          "Fn::Sub": "${CommonName}-order-paid-sub"
        },
        "PushType": "queue",
        "Endpoint": {
          "Fn::Sub": [
            "acs:mns:${ALIYUN::Region}:${ALIYUN::TenantId}:queues/${QueueName}",
            {
              "QueueName": {
                "Fn::GetAtt": [
                  "OrderPaidQueue",
                  "QueueName"
                ]
              }
            }
          ]
        },
        "FilterTag": "paid",
        "NotifyContentFormat": "JSON",
        "NotifyStrategy": "EXPONENTIAL_DECAY_RETRY",
        "DlqPolicy": {
          "Enabled": true,
          "DeadLetterTargetQueue": {
            "Fn::Sub": "${CommonName}-dlq"
          }
        }
      }
    },
    "StockWarningSubscription": {
      "Type": "ALIYUN::MNS::Subscription",
      "DependsOn": [
        "InventoryTopic",
        "StockWarningQueue"
      ],
      "Properties": {
        "TopicName": {
          "Fn::GetAtt": [
            "InventoryTopic",
            "TopicName"
          ]
        },
        "SubscriptionName": {
          "Fn::Sub": "${CommonName}-stock-warning-sub"
        },
        "PushType": "queue",
        "Endpoint": {
          "Fn::Sub": [
            "acs:mns:${ALIYUN::Region}:${ALIYUN::TenantId}:queues/${QueueName}",
            {
              "QueueName": {
                "Fn::GetAtt": [
                  "StockWarningQueue",
                  "QueueName"
                ]
              }
            }
          ]
        },
        "FilterTag": "warning",
        "NotifyContentFormat": "JSON",
        "NotifyStrategy": "BACKOFF_RETRY",
        "DlqPolicy": {
          "Enabled": true,
          "DeadLetterTargetQueue": {
            "Fn::Sub": "${CommonName}-dlq"
          }
        }
      }
    },
    "SmsNotifySubscription": {
      "Type": "ALIYUN::MNS::Subscription",
      "DependsOn": [
        "NotificationTopic",
        "SmsNotifyQueue"
      ],
      "Properties": {
        "TopicName": {
          "Fn::GetAtt": [
            "NotificationTopic",
            "TopicName"
          ]
        },
        "SubscriptionName": {
          "Fn::Sub": "${CommonName}-sms-notify-sub"
        },
        "PushType": "queue",
        "Endpoint": {
          "Fn::Sub": [
            "acs:mns:${ALIYUN::Region}:${ALIYUN::TenantId}:queues/${QueueName}",
            {
              "QueueName": {
                "Fn::GetAtt": [
                  "SmsNotifyQueue",
                  "QueueName"
                ]
              }
            }
          ]
        },
        "FilterTag": "sms",
        "NotifyContentFormat": "JSON",
        "NotifyStrategy": "BACKOFF_RETRY",
        "DlqPolicy": {
          "Enabled": true,
          "DeadLetterTargetQueue": {
            "Fn::Sub": "${CommonName}-dlq"
          }
        }
      }
    }
  },
  "Outputs": {
    "OrderTopicUrl": {
      "Description": {
        "zh-cn": "Order topic URL.",
        "en": "Order topic URL."
      },
      "Label": {
        "zh-cn": "Order topic URL",
        "en": "Order Topic URL"
      },
      "Value": {
        "Fn::GetAtt": [
          "OrderTopic",
          "TopicUrl"
        ]
      }
    },
    "InventoryTopicUrl": {
      "Description": {
        "zh-cn": "Inventory topic URL.",
        "en": "Inventory topic URL."
      },
      "Label": {
        "zh-cn": "Inventory topic URL",
        "en": "Inventory Topic URL"
      },
      "Value": {
        "Fn::GetAtt": [
          "InventoryTopic",
          "TopicUrl"
        ]
      }
    },
    "NotificationTopicUrl": {
      "Description": {
        "zh-cn": "Notification topic URL.",
        "en": "Notification topic URL."
      },
      "Label": {
        "zh-cn": "Notification topic URL",
        "en": "Notification Topic URL"
      },
      "Value": {
        "Fn::GetAtt": [
          "NotificationTopic",
          "TopicUrl"
        ]
      }
    },
    "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",
            "MaxReceiveCount"
          ]
        }
      ]
    }
  }
}