Skip to content

Commit 54421ed

Browse files
author
Tihomir Surdilovic
authored
Update to 'SubFlow State' spec doc (#141)
* Update to 'SubFlow State' spec doc Signed-off-by: Tihomir Surdilovic <[email protected]> * Updates - remove standalone flag, remove function/event inheritance Signed-off-by: Tihomir Surdilovic <[email protected]>
1 parent 99b960c commit 54421ed

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

media/spec/subflowstateref.png

197 KB
Loading

specification.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,11 +1897,11 @@ For more information, see the [workflow error handling and retrying section](#wo
18971897
| id | Unique state id | string | no |
18981898
| name |State name | string | yes |
18991899
| type |State type | string | yes |
1900-
| waitForCompletion |If workflow execution must wait for sub-workflow to finish before continuing | boolean | yes |
1900+
| waitForCompletion | If workflow execution must wait for sub-workflow to finish before continuing | boolean | yes |
19011901
| workflowId |Sub-workflow unique id | boolean | no |
19021902
| [stateDataFilter](#state-data-filter) | State data filter | object | no |
19031903
| [onError](#Workflow-Error-Handling) | States error handling definitions | array | no |
1904-
| [transition](#Transitions) |Next transition of the workflow after subflow has completed | object | yes (if end is not defined) |
1904+
| [transition](#Transitions) | Next transition of the workflow after subflow has completed | object | yes (if end is not defined) |
19051905
| dataInputSchema | URI to JSON Schema that state data input adheres to | string | no |
19061906
| dataOutputSchema | URI to JSON Schema that state data output adheres to | string | no |
19071907
| [metadata](#Workflow-Metadata) | Metadata information| object | no |
@@ -1947,27 +1947,28 @@ end:
19471947

19481948
</details>
19491949

1950-
It is often the case that you want to group your workflows into small, reusable logical units that perform certain needed functionality.
1951-
Even though you can use the Event or Callback states to call externally deployed services (via function), at times
1952-
there is a need to include/inject another serverless workflow (from classpath/local file system etc, depending on the implementation logic).
1953-
In that case you would use the SubFlow state.
1954-
It also allows developers to model their workflows with reusability and logical grouping in mind.
1950+
Often you want to group your workflows into small logical units that solve a particular business problem and can be reused in
1951+
multiple other workflow definitions.
19551952

1956-
This state allows developers to include/inject a uniquely identified sub-workflow and start its execution.
1957-
Another use of this state is within [branches](#parallel-state-branch) of the [Parallel State](#Parallel-State).
1958-
Instead of having to define all states
1959-
in each branch, you could separate the branch states into individual sub-workflows and call the SubFlow state
1960-
as a single state in each.
1953+
<p align="center">
1954+
<img src="media/spec/subflowstateref.png" height="350px" alt="Referencing reusable workflow via SubFlow states"/>
1955+
</p>
1956+
1957+
Reusable workflow are referenced by their `id` property via the SubFlow states`workflowId` parameter.
1958+
1959+
Each referenced workflow receives the SubFlow states data as workflow data input.
1960+
1961+
The `waitForCompletion` property defines if the SubFlow state should wait until the referenced reusable workflow
1962+
has completed its execution.
19611963

1962-
Sub-workflows must have a defined start and end states.
1963-
The `waitForCompletion` property defines if the SubFlow state should wait until execution of the sub-workflow
1964-
is completed or not.
1964+
If `waitForCompletion` is "true", SubFlow state execution must wait until the referenced workflow has completed its execution.
1965+
In this case the workflow data output of the referenced workflow can and should be merged with the SubFlow states state data.
19651966

1966-
Each sub-workflow receives the same copy of the SubFlow state's data input.
1967-
If the `waitForCompletion` property is set to true, sub-workflows have the ability to edit the parent's workflow data.
1968-
If the `waitForCompletion` property is set to false, data access to the parent workflow should not be allowed.
1967+
If `waitForCompletion` is set to "false" the parent workflow can continue its execution while the referenced workflow
1968+
is being executed. For this case, the referenced (child) workflow data output cannot be merged with the SubFlow states
1969+
state data (as by the time its completion the parent workflow execution has already continued).
19691970

1970-
Sub-workflows inherit all the [function](#Function-Definition) and [event](#Event-Definition) definitions of their parent workflow.
1971+
Referenced workflows must declare their own [function](#Function-Definition) and [event](#Event-Definition) definitions.
19711972

19721973
#### Inject State
19731974

0 commit comments

Comments
 (0)