ApsaraVideo Media Processing (MPS) allows you to enable the feature for sending notifications on transcoding jobs to a Message Service (MNS) queue or topic as required.

Enable the feature for sending notifications to an MNS topic

  1. Create an MNS topic and a subscription to the MNS topic.
    1. Activate MNS and authorize a RAM 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.
    3. In the left-side navigation pane, click Topics. On the Topics page, click Create Topic.
    4. In the Create Topic panel, set the parameters that are described in the following table.
      Note You are charged a small amount of fees for existing MNS topics every day. Delete unnecessary MNS topics at the earliest opportunity. For more information about billing, see Pricing. Up to 500 messages can be pushed from an MNS topic per second. To push more than 500 messages per second, use Message Queue for Apache RocketMQ.
      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 (-). It must start with a letter.
      Maximum Message Length The maximum size of a message that can be sent to the MNS topic. Unit: byte. Valid values: 1024 to 65536. Default value: 65536.
      Enable Logging Feature Specifies whether to enable logging. Valid values: Yes and No.
      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.
    5. Click OK. The MNS topic is created, and the details page of the MNS topic appears.
    6. Click Create Subscription.
    7. In the Create Subscription panel, set 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 (-). It 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, which must start with http:// or https://.
      Message Filtering Tag Optional. The tag that is used to filter messages.
      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 of the message that is pushed to the receiver.
      • 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.
    8. Click OK. The subscription is created.
  2. Enable the feature for sending notifications to the MNS topic for an MPS queue for transcoding.
    1. Log on to the MPS console.
    2. In the top navigation bar, select a region.
    3. In the left-side navigation pane, choose Global Settings > Pipelines.
    4. On the Pipelines 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, turn on Notifications, select Topic for the Message Type parameter, and then select the specified MNS topic from the Topic Name drop-down list.
      Parameter Description
      Notifications Turn on Notifications.
      Message Type Select Topic.
      Topic Name Select the specified MNS topic from the Topic Name drop-down list.
    6. Click OK. The feature for sending notifications to the specified MNS topic is enabled for the MPS queue.
  3. When you create a transcoding job, select the MPS queue. Then, you can receive notifications on the transcoding job.

Enable the feature for sending notifications to an MNS queue

  1. Create an MNS queue.
    1. Activate MNS and authorize a RAM 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.
    3. In the left-side navigation pane, click Queues.
    4. On the Queues page, click Create Queue.
    5. In the Create Queue panel, set 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 the 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 it 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.
    6. Click OK. The MNS queue is created.
  2. Enable the feature for sending notifications to the MNS queue for an MPS queue for transcoding.
    1. Log on to the MPS console.
    2. In the top navigation bar, select a region.
    3. In the left-side navigation pane, choose Global Settings > Pipelines.
    4. On the Pipelines 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, turn on Notifications, select Queue for the Message Type parameter, and then select the specified MNS queue.
      Parameter Description
      Notifications Turn on Notifications.
      Message Type Select Queue.
      Queue Name Select the specified MNS queue from the Queue Name drop-down list.
    6. Click OK. The feature for sending notifications to the MNS queue is enabled for the MPS queue.
  3. When you create a transcoding job, select the MPS queue. Then, you can receive notifications on the transcoding job.

Parameters

The following table describes the parameters in a notification on a transcoding job.

Parameter Description
jobId The ID of the job.
type The type of the job. Valid values:
  • Transcode: transcoding
  • Analysis: intelligent template-based analysis
  • Snapshot: snapshot
  • MediaInfo: media information
state The status of the job. Valid values:
  • Success: The job is successful.
  • Fail: The job failed.
code The error code.
msg The error message.