All Products
Search
Document Center

Message Service:Subscription

Last Updated:Dec 25, 2023

A subscription includes a Message Service (MNS) topic to which you want to subscribe and an endpoint that you want to use to receive messages. You can call the Subscribe operation to create a subscription. MNS pushes the most recent messages of a topic that you specified for the subscription. After the subscription is created, MNS pushes messages to the specified endpoint. If the endpoint is invalid, the messages fail to be pushed. In this case, MNS retries to push messages based on the specified retry policy. If the retries fail, the messages are discarded.

SubscriptionURL

  • The subscription URL is in the http://$AccountId.mns.<Region>.aliyuncs.com/topic/$TopicName/subscriptions/$SubscriptionName format.

    • mns.<Region>.aliyuncs.com: the endpoint of MNS.

      Region: the ID of the region where MNS is activated. Replace <Region> based on your business scenario. For more information about region-specific MNS endpoints, see Regions and endpoints.

    • AccountId: the account ID of the topic owner.

      When you call MNS API operations, replace the value with the ID of an actual account.

    • TopicName: the name of the topic.

      When you call MNS API operations, replace the value with the name of an actual topic.

    • SubscriptionName: the name of the subscription.

      When you call MNS API operations, replace the value with the name of an actual subscription. The subscription name must be unique in the topic.

Parameters

  • Endpoint

    • The endpoint that is used to receive messages from the topic.

    • Valid value: QueueEndpoint.

  • FilterTag

    • The tag that is used to filter messages.

    • Data type: string.

    • If you configure this parameter, MNS pushes only the messages to which specified tags are attached.

  • NotifyStrategy

    • The retry policy that is applied if a message fails to be pushed.

    • Valid values: BACKOFF_RETRY and EXPONENTIAL_DECAY_RETRY.

    • If a message fails to be pushed, MNS retries to push the message based on the specified retry policy. If the retries fail, MNS discards the message and continues to push the next message.

      For more information about retry policies, see NotifyStrategy.

  • NotifyContentFormat

    • The format of the message that is pushed to the endpoint.

    • Valid values: XML and SIMPLIFIED.

      For more information about message formats, see NotifyContentFormat.

  • CreateTime

    • The time when the subscription was created. The value is a UNIX timestamp. It is the number of seconds that have elapsed since 00:00:00 Thursday, January 1, 1970.

  • LastModifyTime

    • The time when the subscription was last modified. The value is a UNIX timestamp. It is the number of seconds that have elapsed since 00:00:00 Thursday, January 1, 1970.