Receive task completion notifications via HTTP callback or MQ
Instead of polling for task results, you can configure an HTTP callback URL or RocketMQ to receive task completion notifications from EventBridge. Once notified, query the result API once to get the output.
Background
Alibaba Cloud Model Studio integrates with EventBridge to deliver task completion events to your configured event targets.
When an asynchronous task finishes (success or failure), a task completion event containing the task status and ID is reported to EventBridge, which forwards it to your target. For more event targets, see Event targets and Target service types.
Polling vs. event-driven notifications
|
Comparison dimension |
Polling |
Event-driven |
|
Rate limiting |
Result API is rate-limited (20 QPS) |
No rate limiting |
|
Integration complexity |
Simple—poll the result API. Some tasks (such as text-to-image and text-to-video) provide SDKs with built-in polling. |
Configure HTTP callback or RocketMQ in EventBridge and parse notifications. |
|
Server resource consumption |
Consumes server resources with frequent queries. |
No resource consumption—EventBridge pushes to you. |
|
Latency |
Depends on polling interval. |
Near real-time—pushed immediately on completion. |
|
Recommendation |
Low-concurrency or latency-tolerant scenarios. |
High-concurrency or latency-sensitive scenarios. |
Configure one of the following event targets in EventBridge:
-
HTTP callback URL: A publicly accessible or VPC endpoint that accepts POST requests. Suitable for most scenarios.
-
RocketMQ: Consume events via Message Queue for RocketMQ. Ideal for high-reliability scenarios.
Option 1: Configure an HTTP callback URL
Overview
After Alibaba Cloud Model Studio completes a task, it reports the task completion event to EventBridge. EventBridge then pushes this event to your callback endpoint. Your callback endpoint parses the event to extract the successfully processed task ID and calls the result query API once to retrieve the task output.
Benefits: Compared to direct polling, this approach avoids unnecessary polling requests, reduces resource consumption, and lowers pressure on the result query API’s rate limits.
Billing: EventBridge billing.
|
For example, the asynchronous invocation flow using an HTTP callback URL for text-to-image is as follows:
|
|
Procedure
Option 2: Configure RocketMQ
Overview
After Alibaba Cloud Model Studio completes a task, it reports the task completion event to EventBridge. EventBridge forwards the event to Message Queue for RocketMQ. Your application listens to the message queue, consumes the message, extracts the completed task ID, and calls the result query API once to retrieve the task output.
Benefits: Unlike the HTTP callback approach, RocketMQ guarantees message delivery and supports retry on failure—ideal for scenarios requiring high message reliability.
Billing: EventBridge billing, RocketMQ billing.
|
For example, the asynchronous invocation flow using RocketMQ for text-to-image is as follows:
|
|
Procedure
FAQ
Can one event rule have multiple event targets?
Yes. A single event rule can have multiple event targets. If configured, the same event is delivered to every target.
I configured an event rule but am not receiving events. Why?
Ensure the event forwarding rule’s region matches the event’s region. For example, a rule configured in the Singapore region only forwards Singapore events—not other regions. Check the EventBridge region in the region selector at the top of the console page.
HTTP/HTTPS service request times out or returns an error?
Follow these steps to troubleshoot:
-
Check the HTTP/HTTPS service status.
-
Verify the URL configured in the event target.
-
Check the network type configured for the event target:
-
PublicNetwork: Public network—ensure the URL is publicly accessible.
-
PrivateNetwork: VPC network—if selected, verify VPC, vSwitch, and SecurityGroup configurations.
-
Check VPC and vSwitch settings.
-
Check network security group settings.
-
-
-
For other parameter settings, see Event target parameters.

