Skip to main content

SubFlow

View as Markdown

This page lists the Go SDK names for SubFlows. The doc comment of each API gives its parameters, defaults, and errors. Read them in the Go SDK API reference.

API names​

TaskGo APIDex behavior
Start a child Flow and wait for itSubFlow in WaitForSubFlows
Set the child timeout, Attributes, and configurationSubFlowOptionsSubFlowOptions
Choose what happens to an existing childReusePolicy of SubFlowOptions, with SubFlowReusePolicySubFlowReusePolicy
Read the child resultSubFlowResult in Execute. It returns a FlowResult.SubFlow results
Read the generated child Flow IDSubFlowIDSubFlowReusePolicy
Stop a child that lost an AnyOfClient.StopFlow with the child Flow IDStop a Flow

Step types that start SubFlows​

Changed in 1.45: a Step whose Step type contains "-" cannot start SubFlows.

The child Flow ID is "SubFlow:" followed by the parent Flow ID, the Step execution ID, and the SubFlow index, joined with "-". The Step execution ID is the Step type and a counter, also joined with "-". A dash in the Step type makes the child Flow ID ambiguous, so two parents could share one child.

Default Step types are Go type names and never contain "-". Only a GetStepType override can return one. When such a Step returns a Wait with a SubFlow Condition, the Worker logs a warning and sends the WaitFor result unchanged. Dex Server rejects it as an invalid Worker response and fails the attempt without retry. Under the default policy, the Flow fails. Steps with a dash that never start SubFlows are not affected.

To migrate, rename the Step type to a name without "-".

Example​

Example: examples/go/primitives/subflow/parent_flow.go