本文介绍云工作流如何通过集成云工作流来触发工作流执行。使用Operation
状态,functionRef.type
配置为cloudflow:executeWorkflow。
基本概念
参数配置
参数名称 | 是否必选 | 参数说明 | 示例值 |
---|---|---|---|
workflowName | 是 | 被调用工作流名称 | demo1 |
workflowType | 是 | 被调用工作流类型
| express |
executionName | 否 | 工作流执行名称 | test1 |
workflowInput | 是 | 工作流执行输入,JSON格式 |
|
regionId | 是 | 被调用工作流所属地域。 | bb9fdb42056f11eda1610242ac11000 |
返回值与模式
返回值
工作流的执行输出详细数据,示例如下:
{
"workflowExecuteID": "wi-fbf0ec82-18b8-4f22-9349-d07b685067b5",
"workflowExecuteInput": {
"k1": "v1"
},
"workflowExecuteName": "test1",
"workflowExecuteOutput": {
"k1": "v1"
},
"workflowExecuteStartTime": "2025-06-12T07:36:18.714089503Z",
"workflowExecuteStatus": "completed",
"workflowExecuteStopTime": "2025-06-12T07:36:18.733828607Z",
"workflowName": "express-demo"
}
执行模式
云工作流集成工作流执行, 支持请求响应(RequestComplete)、等待系统回调(WaitForSystemCallback)和等待任务令牌(WaitForTaskToken)三种模式。执行模式详细介绍可查看服务集成模式。
示例代码与解析
对不同执行模式的工作流进行示例说明。
请求响应(RequestComplete)示例
specVersion: "0.8"
name: "standard-demo"
start: "ExecuteWorkflow"
states:
- name: "ExecuteWorkflow"
type: "Operation"
metadata: {}
stateDataFilter: {}
actions:
- retryRef: []
catchRef: []
functionRef:
type: "cloudflow:executeWorkflow"
arguments:
workflowName: "express-demo"
workflowType: "express"
executionName: "test1"
workflowInput:
k1: "v1"
regionId: "bb9fdb42056f11eda1610242ac110002"
actionExecuteMode: "RequestComplete"
end: true
以上工作流定义解析如下:
type:固定为
Operation
,标识这是一个Operation状态。functionRef.type:固定为cloudflow:executeWorkflow。
functionRef.arguments: 工作流执行输入参数, JSON格式。
actionExecuteMode:示例使用
RequestComplete
,表示同步执行, 等待工作流执行结果。注意快速工作流仅支持RequestComplete模式。
等待任务令牌(WaitForTaskToken)示例
specVersion: "0.8"
name: "standard-demo"
start: "ExecuteWorkflow"
states:
- name: "ExecuteWorkflow"
type: "Operation"
metadata: {}
stateDataFilter: {}
actions:
- retryRef: []
catchRef: []
functionRef:
type: "cloudflow:executeWorkflow"
arguments:
workflowName: "standard-for-systemcallback"
workflowType: "standard"
executionName: "test1"
workflowInput:
k1: "v1"
taskToken: "{ $Context.taskToken }"
regionId: "bb9fdb42056f11eda1610242ac110002"
actionExecuteMode: "WaitForTaskToken"
end: true
以上工作流定义解析如下:
type:固定为
Operation
,标识这是一个Operation状态。functionRef.type:固定为cloudflow:executeWorkflow。
functionRef.arguments: 工作流执行输入参数, JSON格式; 另外在参数需要添加任务令牌
{ $Context.taskToken }输入参数。
actionExecuteMode:示例使用
WaitForTaskToken
,表示等待任务令牌,仅标准工作流可设置。 当前状态执行完成需要等待到用户用户获取TaskToken后通过ReportTaskSuccess
或ReportTaskFailure
OpenApi触发回调,继续执行。
等待系统回调(WaitForSystemCallback)示例
specVersion: "0.8"
name: "standard-demo"
start: "ExecuteWorkflow"
states:
- name: "ExecuteWorkflow"
type: "Operation"
metadata: {}
stateDataFilter: {}
actions:
- retryRef: []
catchRef: []
functionRef:
type: "cloudflow:executeWorkflow"
arguments:
workflowName: "standard-for-systemcallback"
workflowType: "standard"
executionName: "test1"
workflowInput:
k1: "v1"
regionId: "bb9fdb42056f11eda1610242ac110002"
actionExecuteMode: "WaitForSystemCallback"
end: true
以上工作流定义解析如下:
type:固定为
Operation
,标识这是一个Operation状态。functionRef.type:固定为cloudflow:executeWorkflow。
functionRef.arguments: 工作流执行输入参数, JSON格式。
actionExecuteMode:示例使用
WaitForSystemCallback
,表示等待系统回调, 仅标准工作流可设置。被调用标准工作流执行后,无需用户通过openapi回调taskToken通知被调用工作流执行完成。被调用工作流完成后,系统自动回调,更新ExecuteWorkflow
状态并继续执行。