All Products
Search
Document Center

ApsaraVideo Media Processing:Enable the notification feature for MPS jobs or workflows

Last Updated:Feb 06, 2024

ApsaraVideo Media Processing (MPS) jobs can be run in synchronous or asynchronous mode. Asynchronous jobs cannot receive job results in real time. If you want to monitor status changes of asynchronous jobs in MPS queues or workflows, you can enable the notification feature for the jobs. After you enable this feature, you can monitor whether a transcoding job is successful or whether an automated review job is complete. This topic describes how to enable the notification feature for MPS jobs or workflows.

To enable the notification feature, perform the following steps:

  1. Activate Message Service (MNS).

  2. Create an MNS queue or topic based on your business requirements.

    Note

    The queue-based model is a highly reliable and concurrent consumption model in a one-to-one manner. The topic-based model is a publishing and subscription model in a one-to-many manner.

  3. Optional. Associate the MNS queue or topic with an MPS queue.

  4. Enable the notification feature for a job or workflow.

Step 1: Activate MNS

Important

The notification feature relies on MNS. This feature is free of charge in MPS, but you are charged for using MNS. For more information, see Pricing.

  1. Activate MNS and authorize the current user to access MNS. For more information, see Activate MNS and authorize RAM users to access MNS.

  2. Click Console to go to the MNS console.

Step 2: Create an MNS topic or queue

MPS can send notifications of jobs and workflows to MNS topics or queues. You can create an MNS topic or queue as required.

Create an MNS topic

  1. In the left-side navigation pane of the MNS console, click Topics. On the Topics page, click Create Topic.

  2. In the Create Topic panel, configure the parameters that are described in the following table.

    Parameter

    Description

    Name

    The name of the MNS topic.

    Note

    The name can be up to 120 characters in length and can contain letters, digits, and hyphens (-). The name must start with a letter.

    Maximum Message Length

    The maximum size of a message that can be sent to the MNS topic. Unit: bytes. Valid values: 1024 to 65536. Default value: 65536.

    Enable Logging Feature

    Specifies whether to enable logging.

    Note

    If logging is enabled, MNS automatically pushes the operation logs of this topic to the specified bucket. You can use the logs to view information such as message traces and message delays. For more information, see Log management.

  3. Click OK. The MNS topic is created, and the details page of the MNS topic appears.

  4. Click Create Subscription and configure the parameters that are described in the following table.

    Parameter

    Description

    Name

    The name of the subscription.

    Note

    The name can be up to 255 characters in length and can contain letters, digits, and hyphens (-). The name must start with a letter.

    Push Type

    The push type. Default value: HTTP.

    Receiver Endpoint

    The endpoint of the message receiver.

    Note

    The endpoint is an HTTP URL that starts with http:// or https://.

    Message Filtering Tag

    The tag that is used to filter messages. This parameter is optional.

    Note

    The tag can be up to 16 characters in length.

    Retry Policy

    The retry policy that is applied when an error occurs during message delivery from the MNS topic to the receiver. Valid values:

    • Backoff Retry: retries three times. The retry interval is a random value between 10 and 20 seconds.

    • Exponential Decay Retry: retries 176 times within one day at the following retry intervals that are measured in seconds: 2^0, 2^1, ..., 512, 512, ..., and 512.

    Message Pushing Format

    The format in which a message is pushed to the receiver. Valid values:

    • SIMPLIFIED: The message contains only the published message body and does not contain attribute information.

    • JSON: The message is in the JSON format and contains the message body and message attributes.

    • XML: The message is in the XML format and contains the message body and message attributes.

  5. Click OK. The subscription is created.

Create an MNS queue

  1. In the left-side navigation pane of the MNS console, click Queues.

  2. On the Queues page, click Create Queue. In the Create Queue panel, configure the parameters that are described in the following table.

    Parameter

    Description

    Name

    The name of the MNS queue.

    Maximum Message Length

    The maximum size of a message that can be sent to the MNS queue.

    Long Polling Period

    The maximum period that a ReceiveMessage request can wait till a message is in the MNS queue.

    Visibility Timeout Period

    The period for which a received message remains in the Inactive state.

    Message Retention Period

    The maximum period for which a message can be retained in the MNS queue. After the specified period ends, the message is deleted regardless of whether the message is consumed.

    Scheduled Period

    The period after which all messages sent to the MNS queue can be consumed.

    Enable Logging Feature

    Specifies whether to enable logging.

  3. Click OK. The MNS queue is created.

Step 3: (Optional) Associate the MNS queue or topic with an MPS queue

If you run a job that is added to a regular MPS queue and want to receive notifications of the job, associate the MPS queue with an MNS topic or queue. When you create the job, select the MPS queue that is associated with an MNS topic or queue.

Note

If you run a workflow, you do not need to associate the MPS queue with an MNS queue or topic. Notifications of jobs in the workflow can be sent based on another logic. To receive the notifications for these jobs, you need to only configure the MNS topic or queue for the Input node of the workflow. For more information, see the Enable the notification feature for a workflow section of this topic.

  1. Log on to the MPS console.

  2. In the top navigation bar, select a region.

    Note

    Make sure that you select the region where you submit the MPS jobs. Otherwise, the messages cannot be received.

    地域

  3. In the left-side navigation pane, choose Global Settings > MPS Queue and Callback.

  4. On the MPS Queue and Callback page, find the MPS queue for which you want to enable the notification feature and click Set Notifications in the Actions column.管道开启消息通知

  5. In the Notification Settings dialog box, configure the parameters that are described in the following table.

    Parameter

    Description

    Notifications

    Turn on Notifications.

    Message Type

    Select Queue or Topic based on your business requirements.

    Queue Name

    If you select Queue for the Message Type parameter, select a queue from the Queue Name drop-down list.

    Topic Name

    If you select Topic for the Message Type parameter, select a topic from the Topic Name drop-down list.

  6. Click OK. The MPS queue is associated with an MNS queue or topic.

Step 4: Enable the notification feature

Enable the notification feature for a job

When you create a job, select an MPS queue that is associated with an MNS queue or topic. If the status of the job changes, MPS sends notifications to the associated MNS queue or topic.

Note

The type of the MPS queue you select must be the same as the type of the job. For example, if you create an intelligent thumbnail job, you must select an MPS queue for intelligent thumbnails that is associated with an MNS queue or topic.

Enable the notification feature for a workflow

If you enable the notification feature for a workflow, MPS sends notifications to the associated MNS queue or topic when the workflow starts and ends.

  1. In the left-side navigation pane of the MPS console, choose Workflows > Workflow Orchestration.

  2. On the Workflow Orchestration page, click Create Workflow.

  3. In the Topology section of the Create Workflow page, click the Pen icon next to the Input node.输入

  4. In the Input dialog box, turn on Notifications and configure the parameters that are described in the following table.

    Note

    After you turn on Notifications and select an MPS queue for the Encoding Pipeline parameter, notifications for jobs in the workflow are sent only to the MNS queue or topic that you select in the Input dialog box regardless of whether you have associated the MPS queue with an MPS queue or topic.

    Parameter

    Description

    Input Bucket

    You do not need to configure this parameter. The name of the input bucket automatically appears after you configure the Input Path parameter.

    Input Path

    Click Select next to the Input Path field, configure the parameters in the Select Input Path dialog box, and then click OK to specify the input path of the file to be processed.

    Encoding Pipeline

    Select the MPS queue for transcoding for which you have enabled the notification feature in the previous step.

    Notifications

    Turn on Notifications.

    Message Type

    Select Queue or Topic based on the Message Type parameter that you set when you enable the notification feature for the MPS queue.

    Queue Name or Topic Name

    Select an MNS queue or topic.

  5. For more information about how to configure other nodes, see Create a workflow.

FAQ

For information about answers to some frequently asked questions (FAQ) about the notification feature, see FAQ about messages.