Asynchronous jobs such as transcoding and content moderation do not return results in real time. Set up notifications on an MPS queue or workflow to monitor job status changes.
-
Create a topic or queue based on your requirements.
NoteA queue provides a one-to-one, highly reliable and concurrent consumption model. A topic provides a one-to-many, publish-subscribe model.
-
(Optional) Bind an MPS queue.
-
Set up notifications.
Step 1: Activate Simple Message Queue (formerly MNS)
MPS notifications rely on SMQ to push messages. MPS does not charge for this feature, but SMQ usage incurs charges. Billing.
-
Activate Simple Message Queue (formerly MNS) and grant the required permissions. For detailed instructions, see Activate Simple Message Queue (formerly MNS) and grant permissions.
-
Click Management Console to open the Simple Message Queue (formerly MNS) console.
Step 2: Create a topic or queue
MPS sends notifications by pushing messages to SMQ topics or queues. Create a topic or queue based on your requirements.
Create a topic
-
In the left-side navigation pane of the SMQ console, choose Topics. On the Topic List page, click Create Topic.
-
On the Create Topic page, configure the following parameters.
Parameter
Description
Name
The name of the topic.
NoteThe name must start with a letter, be up to 120 characters long, and contain only letters, digits, and hyphens (-).
Maximum Message Length
Maximum message body size. Valid values: 1024–65536 bytes. Default: 65536.
Enable Logging Feature
Enables logging for this topic.
-
Click OK. The topic is created and you are redirected to the topic details page.
-
Click Create Subscription and configure the parameters.
Parameter
Description
Name
The name of the subscription.
NoteThe name must start with a letter, be up to 255 characters long, and contain only letters, digits, and hyphens (-).
Push Type
Select a push type. Default: HTTP.
Receiver Endpoint
The message Receiver Endpoint.
NoteThe endpoint must be a URL that starts with
http://orhttps://.(Optional) Message Filtering Tag
A tag used to filter messages.
NoteThe tag can be up to 16 characters in length.
Retry Policy
Retry policy when message delivery to the endpoint fails.
-
Backoff Retry: Retries delivery 3 times at random intervals of 10–20 seconds.
-
Exponential Decay Retry: Up to 176 retries over one day. Interval starts at 1 second and increases exponentially (2n) to a maximum of 512 seconds.
Message push format
Format of the pushed message.
-
SIMPLIFIED: Contains only the message body, no attributes.
-
JSON: Message body in JSON format with content and attributes.
-
XML: Message body in XML format with content and attributes.
-
-
Click OK to create the subscription.
Create a queue
-
In the left-side navigation pane of the SMQ console, click Queues.
-
On the Queue List page, click Create Queue and configure the following parameters.
Parameter
Description
Name
The name of the queue.
Maximum Message Length
Maximum message body size sent to the queue.
Long Polling Period
Maximum wait time for a
ReceiveMessagecall when the queue is empty.Visibility Timeout Period
Duration a retrieved message stays hidden from subsequent retrieval requests.
Message Retention Period
Maximum time a message can remain in the queue before deletion, whether or not it has been retrieved.
Delivery delay
Time all messages are delayed before they become consumable.
Enable Logging Feature
Enables log management for this queue.
-
After you configure the parameters, click OK to create the queue.
(Optional) Step 3: Bind an MPS queue
To receive notifications for jobs in a standard MPS queue, bind the queue to your SMQ topic or queue.
Workflow jobs ignore MPS queue notification bindings. To use notifications in a workflow, select the notification topic or queue in the Input node when you create the workflow. Set up notifications for workflow tasks.
-
Log on to the ApsaraVideo Media Processing console.
-
In the top navigation bar, select a Region.
NoteThe MPS queue and your jobs must be in the same region to receive notifications.
-
In the left-side navigation pane, choose .
-
In the MPS queue list, find the MPS queue for which you want to enable notifications and click Set Message Notification in the Actions column.
-
In the Set Message Notification dialog box, configure the following parameters.
Parameter
Description
Notifications
Turn on the switch.
Message Type
Select Queue or Topic based on your SMQ entity type.
Queue name
If you select Queue for Message Type, select the desired queue from the Queue name drop-down list.
Message Name
If you select Topic for Message Type, select the desired topic from the Message Name drop-down list.
-
Click OK to complete the binding.
Step 4: Set up notifications
Set up single-job notifications
When creating a job, select the MPS queue bound to your SMQ topic or queue. MPS sends a notification to the specified destination when the job status changes.
The MPS queue type must match the job type. For example, to receive notifications for an intelligent thumbnail job, use an intelligent thumbnail MPS queue with notifications enabled and select it when creating the job.
Set up workflow notifications
Enable notifications on the workflow Input node to receive notifications when a workflow job starts and finishes.
-
In the ApsaraVideo Media Processing console, choose in the left-side navigation pane.
-
Click Create Workflow to go to the Create Workflow page.
-
In the workflow Topology editing section, click the edit icon on the Input node.
-
In the Input Settings dialog box, turn on Notifications and configure the following parameters.
NoteFor workflow jobs, notification settings on the Input node override MPS queue settings.
Parameter
Description
Input bucket
Automatically populated after you select an input path.
Input Path
Path of the input file to process.
Transcoding MPS Queue
Select a previously bound transcoding pipeline.
Notifications
Turn on to enable notifications.
Message Type
The message destination type. This must match the SMQ entity type (Queue or Topic) that you select below.
Queue (topic) name
Select the destination queue or topic.
-
Configure other workflow nodes as described in Create a workflow.