All Products
Search
Document Center

Intelligent Media Services:Configure callback settings for completed editing jobs

Last Updated:Jun 23, 2026

When you use the online editing feature of Intelligent Media Services (IMS), you can configure callback events to receive job progress and status updates, allowing you to perform other business operations in a timely manner.

Callback methods

You can use HTTP requests and SMQ queues to receive event notifications. For more information, see Callback methods.

Implementation

You can configure custom callback URLs for individual jobs or configure a global callback URL.

  • Custom callback URL for a single job: the callback URL that is specified when you submit an editing and production job. You must call the SubmitMediaProducingJob operation to specify the HTTP or HTTPS callback URL or a Simple Message Queue (SMQ) callback URL.

    • If you use HTTP or HTTPS callbacks, deploy an HTTP service to receive callback messages and specify a callback URL when you submit an editing and production job. When the job is complete, IMS sends an HTTP POST request that contains the job progress in the request body.

    • If you select MNS callbacks, you must configure a message queue that starts with ice-callback in the region where the job is completed. The IMS server sends messages to the message queue.

  • Global callback URL: applies to all media processing jobs. In the Global Settings of IMS, specify a message queue endpoint as the global callback URL. When a job is completed, IMS sends a notification to this URL.

    Note

    Only message queues of SMQ are supported.

Message structure

For more information about the message structure for completed editing and production jobs, see Event list.

Prerequisites

If you use the SMQ queue method, make sure that IMS is authorized to access SMQ. For more information, see Simple Message Queue (formerly MNS): Activation and permissions.

Configure a custom callback URL for a single job

When you call the SubmitMediaProducingJob operation to submit a job, specify the HTTP, HTTPS, or SMQ callback URL in the UserData parameter. Sample code:

  • HTTP or HTTPS callback URL

    {"NotifyAddress":"http(s)://**.**.***"}
  • SMQ callback URL (must be the endpoint of a message queue that starts with ice-callback)

    {"NotifyAddress":"ice-callback-****"}

Configure a global callback URL

  1. Create a message queue in the SMQ console. The message queue must start with ice-callback. For more information, see Create a queue.

  2. Call the SetEventCallback operation to configure event callbacks and specify the name of the message queue created in Step 1 in the CallbackQueueName parameter.

  3. Listen to the message queue in Step 1 and process the messages. The following sample code provides an example.

    Note

    The server SDK version in the following sample code is for reference only. To obtain the latest version, see Server SDK.

    <dependencies>
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>fastjson</artifactId>
        <version>1.2.9</version>
    </dependency>
    <dependency>
        <groupId>com.aliyun.mns</groupId>
        <artifactId>aliyun-sdk-mns</artifactId>
        <version>1.1.9</version>
    </dependency>
    </dependencies>
    import java.util.List;
    
    import com.alibaba.fastjson.JSON;
    import com.alibaba.fastjson.JSONObject;
    
    import com.aliyun.mns.client.CloudAccount;
    import com.aliyun.mns.client.CloudQueue;
    import com.aliyun.mns.client.MNSClient;
    import com.aliyun.mns.common.ClientException;
    import com.aliyun.mns.common.ServiceException;
    import com.aliyun.mns.common.utils.ServiceSettings;
    import com.aliyun.mns.model.Message;
    
    public class IceProduceMessageConsumerDemo {
    
        public static void main(String[] args) {
    
            // Read the SMQ configuration from the ~/.aliyun-mns.properties file:
            // mns.accesskeyid, mns.accesskeysecret, mns.queue.endpoint
            // The RAM user to which the AccessKey pair belongs has full read and write permissions on SMQ.
            CloudAccount account = new CloudAccount(
                ServiceSettings.getMNSAccessKeyId(),
                ServiceSettings.getMNSAccessKeySecret(),
                ServiceSettings.getMNSAccountEndpoint());
            MNSClient client = account.getMNSClient(); //this client need only initialize once
    
            // Demo for receive message code
            try{
                CloudQueue queue = client.getQueueRef("ice-callback-test");// replace with your queue name
                List<Message> messages = queue.batchPopMessage(10, 30);
                for(Message popMsg : messages)
                {
                    if (popMsg != null){
                        System.out.println("message handle: " + popMsg.getReceiptHandle());
                        System.out.println("message body: " + popMsg.getMessageBodyAsString());
                        System.out.println("message id: " + popMsg.getMessageId());
                        System.out.println("message dequeue count:" + popMsg.getDequeueCount());
    
                        JSONObject jsonObject = JSON.parseObject(popMsg.getMessageBodyAsString());
    
                        // Process only messages of the ProduceMediaComplete type:
                        if("ProduceMediaComplete".equals(jsonObject.getString("EventType"))){
                            JSONObject messageBody = jsonObject.getJSONObject("MessageBody");
    
                            System.out.println("ProjectId:" + messageBody.getString("ProjectId"));
                            System.out.println("JobId:" + messageBody.getString("JobId"));
                            System.out.println("Status:" + messageBody.getString("Status"));
                            System.out.println("MediaId:" + messageBody.getString("MediaId"));
                            System.out.println("MediaURL:" + messageBody.getString("MediaURL"));
    
                            //<<to add your special logic.>>
    
                            //remember to  delete message when consume message successfully.
                            //queue.deleteMessage(popMsg.getReceiptHandle());
                            System.out.println("delete message successfully.\n");
                        }
    
    
                    }
                }
            } catch (ClientException ce)
            {
                System.out.println("Something wrong with the network connection between client and MNS service."
                    + "Please check your network and DNS availability.");
                ce.printStackTrace();
            } catch (ServiceException se)
            {
                if (se.getErrorCode().equals("QueueNotExist"))
                {
                    System.out.println("Queue is not exist. Please create queue before use");
                } else if (se.getErrorCode().equals("TimeExpired"))
                {
                    System.out.println("The request is time expired. Please check your local machine timeclock");
                }
                /*
                
                */
                se.printStackTrace();
            } catch (Exception e)
            {
                System.out.println("Unknown exception happened!");
                e.printStackTrace();
            }
    
            client.close();
        }
    }