SubFlows
View as MarkdownUse SubFlows when:
- Each piece of work needs its own history, retries, and lifecycle.
- You need more concurrent work than the concurrency limit of one Flow allows.
Choose a pattern
- Basic parent Flow — Start a runtime-sized group and wait for every SubFlow.
- Wait for half — Wait for half of the SubFlows, then let each unfinished Step stop its own child.
- Advanced: long-lived parent — Keep a fixed worker pool alive and accept requests through an RPC that publishes to a Channel.
- Advanced: short-lived parent — Drain queued requests, then complete when no SubFlow is running and the Channel is empty, without losing a request that arrives at the end.
- Advanced: multiple parents with partitioning — Spread requests across several parent Flows, so total SubFlow concurrency grows with the number of parents.
- Advanced: back pressure for high availability — When an overloaded parent rejects a request, submit it through a Flow that retries until a parent accepts it.
- Cancel with Child Flows — Stop the child Flows a Flow started when the Flow is canceled.
- Child Flows with Business Identity — Start child jobs as top-level Flows named by their own business number, and record how each one ended.
The first four pages are parent Flow shapes. Partitioning and back pressure build on them.