Asynchronous task completion notifications

Updated at:

This topic describes how to use asynchronous task completion notifications and provides examples.

Feature description

After you successfully submit an asynchronous task, you can subscribe to EventBridge to receive a notification when the task is complete.

Important
  • If you have questions about API access, API usage, or other issues related to the Visual Intelligence API, you can join the Alibaba Cloud Visual Intelligence API DingTalk group (23109592) for assistance.

  • This feature requires you to activate EventBridge.

Activate EventBridge

What is EventBridge?

EventBridge is a serverless event bus service from Alibaba Cloud. It allows Alibaba Cloud services, custom applications, and Software as a Service (SaaS) applications to connect in a standardized and centralized way. EventBridge can route events between these applications using the standard CloudEvents 1.0 protocol. This helps you easily build loosely coupled, distributed, event-driven architectures.

For more information, see What is EventBridge?.

For instructions on activation and authorization, see Activate EventBridge and grant permissions.

Billing

You are not charged for delivering events to EventBridge.

To consume messages from EventBridge, you must connect to a consumer service. For billing details, see the documentation for that service.

Connect to the viapi event source

  1. Log on to the EventBridge console.

  2. In the navigation pane on the left, click Event Bus.

  3. In the top menu bar, select the China (Shanghai) region.

  4. On the Event Bus page, click the cloud service event bus named default.

  5. On the Event Rules page, click Create Rule.

  6. On the Create Rule page, complete the following steps.

    1. On the Configure Basic Information page, enter a Name and an optional Description, and then click Next.

    2. On the Configure Event Pattern page, set Event Source to acs.viapi, set Event Type to viapi:system:AsyncJobFinish, and then click Next.

    3. On the Configure Event Target page, configure parameters such as Service Type, Address, and Key as needed, and then click Create.

Event pattern matching

An event pattern defines how EventBridge filters and routes events to a target. The event pattern must have the same structure as the events it is designed to match.

You can use event pattern matching to customize which events you receive from specific products. For example, if you want to receive events only from the `ocr` product where the `popApiName` is `RecognizeCharacter`, you can define a custom event rule in the event pattern.

Procedure

  1. Log on to the EventBridge console.

  2. In the navigation pane on the left, click Event Bus.

  3. In the top menu bar, select the China (Shanghai) region.

  4. On the Event Bus page, click the cloud service event bus named default.

  5. On the Event Rules page, click Edit Event Pattern to the right of the rule that you created earlier.

  6. On the edit rule page, enter the following filter rule in the Pattern Content field.

    {
        "source": [
            "acs.viapi"
        ],
        "type": [
            "viapi:system:AsyncJobFinish"
        ],
        "data": {
            "popApiName": [
                "RecognizeCharacter"
            ],
            "popProduct": [
                "ocr"
            ]
        }
    }
  7. Click Confirm to save the configuration.

Common consumer service types

Event notifications support the following common service types:

Lightweight Message Queue

Alibaba Cloud Message Service is an efficient, reliable, secure, and scalable distributed messaging service. It helps application developers transfer data and notifications between the distributed components of their applications to build loosely coupled systems.

For more information, see Message Service.

Message Queue for Apache RocketMQ

Message Queue for Apache RocketMQ is a distributed platform for unified message, event, and stream processing. Built by Alibaba Cloud on Apache RocketMQ, it features low latency, high concurrency, high availability, and high reliability. It provides core capabilities for distributed applications, such as asynchronous decoupling for microservices, stream data processing, and event-driven processing.

For more information, see What is Message Queue for Apache RocketMQ?.

DingTalk

DingTalk is a digital collaboration and management platform from Alibaba. It offers features such as video conferencing, instant messaging with read receipts, and task management to improve communication efficiency. DingTalk also provides solutions for mobile office needs, such as attendance, approvals, document collaboration, and education.

For more information, see DingTalk.

Short Message Service

Short Message Service (SMS) is a communication service provided by Alibaba Cloud that includes Domestic SMS and International SMS. You can use the API, SDK, or console to send messages to mobile numbers in or outside mainland China.

For more information, see Short Message Service.