If the notification feature is enabled for a media workflow, notifications are sent to the specified Message Service (MNS) queue or topic when the execution of the media workflow starts and ends.

Procedure

  1. Create an MNS queue or topic as required and enable the feature for sending notifications to the MNS queue or topic for an ApsaraVideo Media Processing (MPS) queue for transcoding. For more information, see Enable the feature for sending notifications on transcoding jobs.
  2. Create a workflow. Configure the Input node as described in the following table. For more information about how to configure other nodes, see Create a workflow.
    Parameter Description
    Input Bucket You do not need to set this parameter. The name of the input bucket automatically appears after you set the Input Path parameter.
    Input Path Click Select next to the Input Path field, set 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 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 enabled the notification feature for the MPS queue.
    Queue Name or Topic Name Select the specified MNS queue or topic.

Message format

A message in which a notification on a media workflow is sent is in the JSON format. For more information about the parameters in the message, see the description of media workflow messages in the AddMedia topic.

Message structure:
  • Start

    The activity type in the basic attributes of the activity is Start.

  • Structure
    • Top level

      A JSON object. Definition: {Basic attributes of the current activity,Object of workflow execution details}

      • Basic attributes of the current activity

        The basic attributes of the current activity are not an independent object, but key-value pairs that directly belong to the top level. The following code provides an example. Definition: {ID of the workflow execution instance,Activity name,Activity type,Activity status,Error code and message}

      • Object of workflow execution details

        A JSON object. Definition: {ID of the workflow execution instance,Media workflow ID,Media workflow name,Media file ID,Input file,Workflow execution type,Array of activity objects,Creation time}

    • Array of activity objects

      A JSON array that contains all activities in the current state. For example, only one Start activity object is included in a message for notifying you that the execution of the workflow starts, and all activity objects are included in a message for notifying you that the execution of the workflow ends. Definition: [Activity object 1,Activity object 2,…]

      • Activity object 1

        A JSON object. Definition: {Activity name,Activity type,Job ID,Activity status,Start time,End time,Error code and message}

      • Activity object 2

        The structure is the same as that of Activity object 1.

  • End

    The activity type in the basic attributes of the activity is Report.

  • Example
    {      
          "RunId": "8f8aba5a62ab4127ae2add18da20****",
          "Name": "Act-4",
          "Type": "Report",
          "State": "Success",
          "MediaWorkflowExecution": {
            "Name": "ConcurrentSuccess",
            "RunId": "8f8aba5a62ab4127ae2add18da20****",
            "Input": {
                "InputFile": {
                    "Bucket": "exampleBucket****",
                    "Location": "oss-test", 
                   "Object": "mediaWorkflow/ConcurrentSuccess/01.wmv",
               }
            },
            "State": "Success",
            "MediaId": "2be491ab4cb6499cd0befe5fcf0c****",
            "ActivityList": 
    [            
    {
                    "RunId": "8f8aba5a62ab4127ae2add18da20****",
                    "Name": "Act-1",
                    "Type": "Start",
                    "State": "Success",
                    "StartTime": "2016-03-15T02: 53: 41Z",
                    "EndTime": "2016-03-15T02: 53: 41Z",
                },
                {                
                    "RunId": "8f8aba5a62ab4127ae2add18da20****",
                    "Name": "Act-2",
                    "Type": "Transcode",
                    "JobId": "f34b6d1429dd491faa7a6c1c8f90****",
                    "State": "Success",
                    "StartTime": "2016-03-15T02: 53: 43Z",
                    "EndTime": "2016-03-15T02: 53: 47Z",
                },
                {                
                    "RunId": "8f8aba5a62ab4127ae2add18da20****",
                    "Name": "Act-3",
                    "Type": "Snapshot",
                    "JobId": "c14150be33304825a5d67cd5364c****",
                    "State": "Success",
                    "StartTime": "2016-03-15T02: 53: 44Z",                
                    "EndTime": "2016-03-15T02: 53: 45Z",
                },
                {                
                    "RunId": "8f8aba5a62ab4127ae2add18da20****",
                    "Name": "Act-4",
                    "Type": "Report",
                    "State": "Success",
                    "StartTime": "2016-03-15T02: 53: 49Z",
                    "EndTime": "2016-03-15T02: 53: 49Z", 
               }
            ],
            "CreationTime": "2016-03-15T02: 53: 39Z",
          }
      }