CloudFlow integrates with EventBridge through the EventBridge:PutEvents action, which publishes events from a workflow task node to an event bus. This triggers downstream event-driven processing without custom API code.
Two integration modes are available:
RequestComplete -- The task completes as soon as EventBridge acknowledges the request. Use this when the workflow does not depend on downstream event processing.
WaitForCustomCallback -- The task pauses the workflow until an external system reports the result through a callback. Use this when the workflow must wait for a downstream consumer to finish.
Workflow definition
The following YAML defines a workflow that publishes an event to EventBridge:
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: PutEvents
States:
- Type: Task
Name: PutEvents
Action: EventBridge:PutEvents
TaskMode: RequestComplete
Description: an example of integration with EventBridge
Parameters:
id: xxxxx-xxxx-xxxx-xxxx
type: aliyuncvc:MeetingEvent:MemberOperate
eventBusName: fnf-eb-bus
subject: test-subject
source: test-source
data:
eventContent:
key1: val1
key2: val2
End: trueConfigure the following fields in the Task state:
| Field | Value | Description |
|---|---|---|
Action | EventBridge:PutEvents | Publishes events to the specified event bus |
TaskMode | RequestComplete or WaitForCustomCallback | Controls whether the workflow continues immediately or waits for a callback. See Integration modes |
Name | Custom | Descriptive name for the task |
Description | Custom | Brief description of the task purpose |
Parameters
The Parameters block defines the event payload. Fields align with the CloudEvents specification.
Required parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
id | String | Unique event identifier. Producers must ensure that source + id is unique per event. EventBridge uses this value for tracking and deduplication. | 45ef4dewdwe1-7c35-447a-bd93-fab**** |
source | String | Event source identifier. Specifies the service or context that produced the event. | acs:aliyuncvc |
type | String | Event type. Used for routing, querying, and policy enforcement. The format is defined by the producer and includes information such as the version number. | aliyuncvc:MeetingEvent:MemberOperate |
eventBusName | String | Target event bus name. This field is specific to EventBridge and is not part of the CloudEvents specification. | default |
Optional parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
subject | String | Event subject. Defaults to the Alibaba Cloud Resource Name (ARN) of the current workflow. Use this for fine-grained subscription filtering when data alone is insufficient. | acs.fnf:cn-hangzhou:{AccountId}:215672 |
data | Object | Event payload. The structure is determined by the event source. | See the example below |
data example:
data:
meetingName: swqd
groupId: 456
action: camera_off
time: 1590592527490
userId: 199525****
meetingUUID: hz-20864c8f-b10d-45cd-9935-884bca1b****Return value
PutEvents returns a JSON object that contains the result of each event entry:
{
"EntryList": [
{
"ErrorCode": null,
"ErrorMessage": null,
"EventID": "61fcd09a-eb42-48fb-9bf5-*********",
"TraceID": "4C9FEA1480767FDA352**********"
}
],
"FailedEntryCount": 0,
"RequestID": "6538799543**************",
"ResourceOwnerAccountID": null
}| Field | Description |
|---|---|
EntryList | Array of result entries, one per event |
ErrorCode | Error code for the entry. null on success |
ErrorMessage | Error message for the entry. null on success |
EventID | Unique identifier assigned by EventBridge |
TraceID | Trace identifier for event tracking |
FailedEntryCount | Number of failed entries. 0 means all events were published |
RequestID | Unique request identifier |
ResourceOwnerAccountID | Resource owner account ID |
Integration modes
RequestComplete
The task completes as soon as EventBridge acknowledges the PutEvents request. The workflow advances to the next state immediately.
Use this mode when downstream event processing does not affect the workflow outcome.
WaitForCustomCallback
The task pauses the workflow after delivering the event. The workflow remains suspended until an external system calls ReportTaskSucceeded or ReportTaskFailed to report the result.
Use this mode when the workflow depends on a downstream consumer finishing its work before advancing.
To pass the task token to the event consumer, add a custom key in data that references $Context.Current.TaskToken:
Type: StateMachine
Name: MyCallbackWorkflow
SpecVersion: v1
StartAt: PutEventsAndWait
States:
- Type: Task
Name: PutEventsAndWait
Action: EventBridge:PutEvents
TaskMode: WaitForCustomCallback
Parameters:
id: xxxxx-xxxx-xxxx-xxxx
type: aliyuncvc:MeetingEvent:MemberOperate
eventBusName: fnf-eb-bus
source: test-source
data:
taskToken: $Context.Current.TaskToken
eventContent:
key1: val1
key2: val2
End: trueThe event consumer extracts the taskToken value from the event payload and calls ReportTaskSucceeded or ReportTaskFailed with that token to resume the workflow.