SubFlow
查看 MarkdownThis page lists the Java SDK names for SubFlows. The doc comment of each API gives its parameters, defaults, and errors. Read them in the Java SDK API reference.
API names
| Task | Java API | Dex behavior |
|---|---|---|
| Start a child Flow and wait for it | SubFlow.run in waitFor | SubFlows |
| Set the child timeout, Attributes, and configuration | SubFlowOptions | SubFlowOptions |
| Choose what happens to an existing child | reusePolicy of SubFlowOptions.Builder, with SubFlowReusePolicy | SubFlowReusePolicy |
| Read the child result | SubFlow.getConditionResults in execute. It returns a FlowResult. | SubFlow results |
| Read the generated child Flow ID | SubFlow.getFlowId | SubFlowReusePolicy |
| Stop a child that lost an AnyOf | Client.stopFlow with the child Flow ID | Stop a Flow |
Step types that start SubFlows
The generated child Flow ID is SubFlow:{parent Flow ID}-{Step execution ID}-{index}. The Step execution ID starts with the Step type. A Step whose Step type contains - cannot start SubFlows, because the dash would make the child Flow ID ambiguous. When waitFor of such a Step returns a SubFlow.run condition, the Worker sends the result and logs a warning. The server rejects the result as an invalid Worker response and fails the attempt without retry. With the default failure policy, the Flow fails. Steps that start no SubFlows may keep a dash in their Step type. To start SubFlows from the Step, rename its Step type, for example by overriding getStepType.
Changed in 1.45: a Step whose Step type contains - can no longer start SubFlows.
Example
Example: examples/java/src/main/java/io/superdurable/dex/primitives/subflow/SubFlowParentFlow.java