All Products
Search
Document Center

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

Last Updated:Oct 21, 2024

ApsaraVideo Media Processing (MPS) jobs can be run in synchronous or asynchronous mode. You cannot receive the results of asynchronous jobs 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 Simple Message Queue (formerly MNS) (SMQ).

  2. Create a queue or topic in SMQ based on your business requirements. For more information, see the following sections of this topic:

    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 queue or topic in SMQ with an MPS queue. For more information, see the Associate the queue or topic section of this topic.

  4. Enable the notification feature for a job or workflow. For more information, see the following sections of this topic:

Step 1: Activate Simple Message Queue (formerly MNS)

Important

The notification feature relies on SMQ. You can use this feature free of charge in MPS, but you are charged for using SMQ. For more information about the billing details, see Billing.

  1. Activate Simple Message Queue (formerly MNS) and authorize the current user to access SMQ. For more information, see Activate SMQ and authorize RAM users to access SMQ.

  2. Click Console to go to the Simple Message Queue (formerly MNS) console.

Step 2: Create a topic or queue in SMQ

MPS can send notifications about jobs and workflows to topics or queues in SMQ. You can create a topic or queue in SMQ based on your business requirements.

Create a topic

  1. In the left-side navigation pane of the SMQ console, choose Topic Model > 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 SMQ 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 SMQ topic. Unit: bytes. Valid values: 1024 to 65536. Default value: 65536.

    Enable Logging Feature

    Specifies whether to enable the logging feature.

    Note

    After the logging feature is enabled, Simple Message Queue (formerly 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 SMQ topic is created, and the details page of the SMQ topic appears.

  4. On the Subscriptions tab, click Create Subscription. In the Create Subscription panel, configure the parameters that are described in the following table.

    Parameter

    Description

    Topic 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.

    Subscription

    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 SMQ topic to the receiver. Valid values:

    • Backoff Retry: retries three times. The retry interval is a random value in the range of 10 to 20. Unit: second.

    • 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 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 SMQ queue

  1. In the left-side navigation pane of the SMQ console, choose Queue Model > 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 SMQ queue.

    Maximum Message Length

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

    Long Polling Period

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

    Visibility Timeout Period

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

    Message Retention Period

    The maximum period during which a message can be retained in the SMQ 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 SMQ queue can be consumed.

    Enable Logging Feature

    Specifies whether to enable the logging feature.

  3. Click OK. The SMQ queue is created.

Step 3: (Optional) Associate the SMQ 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 about the job, associate the MPS queue with an SMQ 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 SMQ queue or topic. Notifications of jobs in the workflow can be sent based on another logic. To receive the notifications about these jobs, you need to only configure the SMQ 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 in which 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 set the Message Type parameter to Queue, select a queue from the Queue Name drop-down list.

    Topic Name

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

  6. Click OK. The MPS queue is associated with an SMQ 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 SMQ queue or topic. If the status of the job changes, MPS sends notifications to the SMQ queue or topic associated with the MPS queue.

Note

The type of the MPS queue that 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 SMQ 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 SMQ queue or topic when the workflow starts and ends.

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

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

  3. In the Task Configuration (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 about jobs in the workflow are sent only to the SMQ queue or topic that you select in the Input dialog box regardless of whether you have associated the MPS queue with an SMQ 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 SMQ 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.