All Products
Search
Document Center

Reliable MNS event notifications

Last Updated: Jul 31, 2019

Overview

  • Alibaba Cloud Message Service (MNS) is an efficient, reliable, secure, convenient, and elastically scalable distributed message service. MNS provides the queue model. MNS allows multiple producers and consumers to concurrently access the same queue. After a message is obtained by a consumer, MNS ensures that the message cannot be obtained by other consumers within a specified period. A message is invisible for a period of time after it is consumed. You need to delete the message manually. Otherwise, the message can be consumed again. For more information, see MNS product documentation.
  • ApsaraVideo for VOD supports multiple storage regions (such as Mainland China, Singapore, and Frankfurt). You can configure the event notification callback method and URL for each region separately. Users can upload videos to different storage regions. After videos are processed (for example, uploaded or transcoded), ApsaraVideo for VOD notifies users of the processing result in a timely manner based on the callback configurations for the storage regions. For MNS callbacks, ApsaraVideo for VOD pushes messages to MNS queues.

Configuration procedure

  • Log on to the Alibaba Cloud console and go to the Cloud Resource Access Authorization page. Click Confirm Authorization Policy, as shown in the following figure.voddefaultrole
  • Log on to the MNS console and create a queue or select an existing queue. (We recommend that you use a queue in China (Shanghai) if your videos are stored in Mainland China.) Then, submit a ticket to specify the region for which the callback service is configured, callback events, queue name, and Internet endpoint. You can click Get Endpoint in the upper-right corner of the MNS console to obtain the Internet Endpoint. For more information about callback event types, see Event notification overview.createQueue
  • When receiving the ticket (containing the region for which the callback service is configured, callback events, queue name, and Internet endpoint), ApsaraVideo for VOD technical support configure the callback service for you. After the configuration is completed, log on to the ApsaraVideo for VOD console and upload a video to trigger a callback event.
  • When the conditions for generating a callback event are met, ApsaraVideo for VOD pushes a message to the queue that you provide. Log on to the MNS console, click Receive Message to view the message in the Receive Message window, as shown in the following figure.receiveMessage

Message consumption

MNS allows multiple producers and consumers to concurrently access the same queue. After a message is obtained by a consumer, MNS ensures that the message cannot be obtained by other consumers within a specified period. A message is invisible for a period of time after it is consumed. You need to delete the message manually. Otherwise, the message can be consumed again.

Precautions

  • If ApsaraVideo for VOD is unauthorized to access MNS, the MNS endpoint is not an Internet endpoint, or the queue name is incorrect, the message fails to be pushed to the queue when ApsaraVideo for VOD initiates an MNS callback. In this case, ApsaraVideo for VOD retries the push twice. That is, ApsaraVideo for VOD attempts to push a message to the queue for a total of three times. If the message still fails to be pushed, ApsaraVideo for VOD discards the message.
  • If videos are stored in Mainland China, such as China (Beijing) and China (Shanghai), a short delay may occur when you push messages to a queue in a region other than China (Shanghai). We recommend that you use a queue in China (Shanghai).
  • If videos are stored in Singapore, we recommend that you log on to the MNS console, create or use a queue in Singapore, and submit a ticket for callback configuration.
  • If videos are stored in Frankfurt, we recommend that you log on to the MNS console, create or use a queue in Frankfurt, and submit a ticket for callback configuration.