跳到主要内容

SubFlow

查看 Markdown

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

API names​

TaskRust APIDex behavior
Start a child Flow and wait for itSubFlow::run in wait_forSubFlows
Set the child timeout, Attributes, and configurationSubFlowOptions, with SubFlow::run_with_optionsSubFlowOptions
Choose what happens to an existing childreuse_policy of SubFlowOptions, with SubFlowReusePolicySubFlowReusePolicy
Read the child resultSubFlow::condition_result or SubFlow::condition_result_at in execute. It returns a FlowResult.SubFlow results
Read the generated child Flow IDSubFlow::flow_id or SubFlow::flow_id_atSubFlowReusePolicy
Stop a child that lost an AnyOfClient::stop_flow with the child Flow IDStop a Flow

Step types that start SubFlows​

Changed in 1.45: a Step whose Step type contains a dash (-) cannot start SubFlows.

Dex builds each child Flow ID from the parent Flow ID, the Step execution ID, and the SubFlow index. It joins them with a dash. The Step execution ID starts with the Step type. A dash in the Step type therefore lets two parents generate the same child Flow ID.

If such a Step returns a Wait with a SubFlow Condition from wait_for, the Worker logs a warning and sends the result unchanged. The server rejects it as an invalid Worker response. It fails the attempt without retry, so under the default policy the Flow fails. Steps with a dash in their Step type can still use every other Condition.

To start SubFlows from the Step, rename its Step type. Override Step::step_type to return a name without a dash. The default Step type is the Rust type name, which never contains a dash.

Example​

Example: examples/rust/src/primitives/subflow/flow.rs