All Products
Search
Document Center

Intelligent Media Management:Example: Process asynchronous task messages with SMQ

Last Updated:Jun 21, 2026

This topic describes how to use Simple Message Queue (SMQ) to receive status notifications for asynchronous tasks from Intelligent Media Management (IMM).

Create Simple Message Queue (SMQ) resources

Step 1: Create an SMQ topic

  1. Log on to the Simple Message Queue (SMQ) management console.

  2. In the left-side navigation pane, select Topic List and click Create Topic.

  3. In the Create Topic panel, create a topic named tf-test-mns-topic.

    Set maximum message length to 65536 and set Enable Logging to No.

  4. Click OK.

Step 2: Create an SMQ queue

  1. Log on to the Simple Message Queue (SMQ) management console.

  2. In the left-side navigation pane, select Queue List and click Create Queue.

  3. In the Create Queue panel, create a queue named tf-test-mns-queue.

    Configure the queue parameters as follows: set maximum message length to 64 KB, long polling time to 0 seconds (which disables long polling), visibility timeout to 30 seconds, message retention period to 4 days, and message delay to 0 seconds. Keep Enable Logging disabled.

  4. Click OK.

Step 3: Associate the SMQ topic and queue

  1. Log on to the Simple Message Queue (SMQ) management console.

  2. In the left-side navigation pane, select Topic List and click the topic that you created in Step 1: Create an SMQ topic, which is tf-test-mns-topic.

  3. Select the Subscription List tab and click Create Subscription.

  4. In the Create Subscription panel, create a subscription named tf-test-mns-subscription with the following settings:

    • Subscription Type: Select Queue.

    • Receiver Endpoint: Select tf-test-mns-queue, the queue you created in Step 2: Create an SMQ queue.

    • Message Format: Select JSON.

  5. Click OK.

Optional: Create Object Storage Service (OSS) resources

Note

If you already have the required resources in Object Storage Service (OSS), you can skip this section and proceed to initiate a call to IMM.

Step 1: Create a bucket

  1. Log on to the Object Storage Service (OSS) management console.

  2. In the left-side navigation pane, select Buckets and click Create Bucket.

  3. In the Create Bucket panel, create a bucket named tf-test-oss-bucket.

Step 2: Upload a file

  1. Log on to the Object Storage Service (OSS) management console.

  2. In the left-side navigation pane, select Buckets and click tf-test-oss-bucket, the bucket you created in Step 1: Create a bucket.

  3. Click Upload Object and follow the on-screen instructions to upload the 1.docx file.

Initiate an IMM call

Step 1: Create a project

  1. Log on to the Intelligent Media Management (IMM) management console.

  2. In the left-side navigation pane, select Project List and click Create Project.

  3. In the Create Project panel, create a project named tf-test-imm-project and set the service-linked role to AliyunIMMDefaultRole.

    Important

    If you use a custom service role, see Configure a service role for a project to learn how to set permissions.

  4. Click OK.

Step 2: Initiate an IMM call

  1. Log on to OpenAPI Explorer.

  2. In the API list on the left, choose Document Processing > CreateOfficeConversionTask.

  3. Enter the following parameter values:

    • ProjectName: Enter tf-test-imm-project, the project you created in Step 1: Create a project.

    • SourceURI: Enter oss://tf-test-oss-bucket/1.docx, the path of the source file you uploaded in Step 2: Upload a file or another document in the bucket.

    • TargetURIPrefix: Enter oss://tf-test-oss-bucket/output, the storage path prefix for the converted output file.

    • TargetType: Enter png, the file type of the converted output.

    • TopicName: Enter tf-test-mns-topic, the SMQ topic you created in Step 1: Create an SMQ topic.

  4. Click Initiate Call.

Receive SMQ messages

  1. Log on to the Simple Message Queue (SMQ) management console.

  2. In the left-side navigation pane, select Queue List and click tf-test-mns-queue, the queue you created in Step 2: Create an SMQ queue.

  3. In the upper-right corner of the Queue Details page, click Send and Receive Messages.

  4. On the Send and Receive Messages page, click Receive Message. A new message appears on the page.

    The received message record includes the Message ID, Consume Count, First Consume Time, Message Creation Time, and Actions (Details, Delete) columns.

  5. In the Actions column for the message, click Details to view the message details.

    The message details dialog box contains basic information (message ID, Consume Count, First Consume Time, Message Creation Time, Next Visible Time, and message handle) and an Original Message Content area. The message type is imm:Task:OfficeConversion and the source is acs.imm, indicating that the IMM document conversion task was triggered successfully. The dialog box also displays the Base64-decoded message content and the Message MD5 Content.

FAQ

Cannot receive SMQ messages

If you cannot receive SMQ messages, verify the following:

  • Check whether the SMQ topic and the IMM project are in the same region.

  • Check that the SMQ queue is subscribed to the topic and the subscription's message format is set to JSON.

  • Check whether multiple consumers are consuming messages from the queue at the same time.

  • Check whether the service role for the IMM project has permissions to send messages to SMQ. For details, see Configure a service role for a project.