在这个例子中,我们有2个流程,第一个流程“Workflow Process 1”包含一个Subflow,可以调用第二个流程“Workflow Process 2”。
图1:工作流程过程1和子流程到工作流程过程2
工作流程过程1有一个名为“firstStatus”的声明工作流程变量。
图2:工作流程2
工作流程过程2有一个名为“secondStatus”的声明工作流程变量。
子流程属性
标题 | 描述 |
---|---|
Id | 要调用的流程 |
Execution | 同步: 调用并创建子流实例,并等待子流程完成,然后再继续到工作流程过程中的下一个节点。 |
Subflow Parameters / Actual Parameters | 子流程中的工作流程变量将与当前工作流程过程中的现有工作流程变量进行映射。子流参数和实际参数中的条目数应该相同。
|
示例:
在上面的截图中,子流程将同步执行。参数设置为“ In and Out”。
让我们按照时间顺序浏览整个流程:
- 流程开始“工作流程过程1”
- “活动1”开始了。
- 以“firstStatus”设置为“a”完成的“活动1”。
- 子流程已启动。由于参数设置为“ In and Out”,现在将子流程的值“a”设置为“secondStatus”。
- “活动3”从“secondStatus”开始,初始化为“a”。
- 以“secondStatus”设置为“ab”完成“活动3”。
- “活动4”以“secondStatus”开始初始化为“ab”开始。
- “活动4”以“secondStatus”设置为“abc”完成。
- 子流程现在已经结束了。由于参数设置为“In and Out ”,所以值“abc”现在返回到父进程的“firstStatus”。“活动2”以“firstStatus”设置为“abc”开始。
In this example, we have 2 processes, with the first process "Workflow Process 1" containing a Subflow calling the second process "Workflow Process 2".
Figure 1: Workflow Process 1 with Subflow to Workflow Process 2
Workflow Process 1 has one declared workflow variable named "firstStatus".
Figure 2: Workflow Process 2
Workflow Process 2 has one declared workflow variable named "secondStatus".
Subflow Properties
...
Title
...
Description
...
Id
...
Process to be called
...
Execution
...
Synchronous: calls and creates the subflow instance and waits for the subflow process to finish before continuing to the next node in the workflow process
Asynchronous: calls the subflow process and continues to the next node in the process, without waiting
...
Subflow Parameters / Actual Parameters
...
- In: pass the value from the current workflow process's variable to the subflow process's variable only upon calling up the subflow process.
- Out: pass the value from the subflow workflow process's variable to the current workflow process's variable only upon completion of the subflow process.
- In and Out: a combination of the above
Example:
In the screenshot above, the subflow process will be executed synchronously. Parameter is set to "In and Out".
Let's walk through the entire process flow chronologically:
- Start of process "Workflow Process 1"
- "Activity 1" started.
- "Activity 1" completed with "firstStatus" set to "a".
- Subflow process started. As the parameter is set to "In and Out", the value "a" is now set to "secondStatus" of the subflow process.
- "Activity 3" started with "secondStatus" initialized to "a".
- "Activity 3" completed with "secondStatus" set to "ab".
- "Activity 4" started with "secondStatus" initialized to "ab".
- "Activity 4" completed with "secondStatus" set to "abc".
- The subflow process has now come to an end. As the parameter is set to "In and Out", the value "abc" is now returned to "firstStatus" of the parent process. "Activity 2" started with "firstStatus" set to "abc".