Add Resilient Fan-Out sample: partial-failure tolerance in a heterogeneous DAG - #790
Open
brainlimitexceeded wants to merge 1 commit into
Open
Conversation
…neous DAG Adds a sample demonstrating a pattern not covered by the existing Child Workflow docs/samples: a fan-out with one critical branch and several best-effort branches, where: - each branch is awaited independently (not via Promise.allOf(...)), so a best-effort failure can't take down a healthy critical branch or vice versa - still-running best-effort children are explicitly cancelled via a CancellationScope when the critical branch fails, instead of relying on the default ParentClosePolicy (TERMINATE), which kills a child with no CanceledFailure to react to - failure is reconciled via Saga with parallel compensation, repurposed for independent, isolated notifications rather than classic "undo what I did" semantics Includes a runnable Starter for all three outcomes and unit tests covering the happy path, a degraded-but-successful run, and a critical failure that triggers cancellation + reconciliation.
brainlimitexceeded
requested review from
a team,
antmendoza and
tsurdilo
as code owners
August 6, 2026 20:21
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a sample demonstrating a pattern I couldn't find covered by the existing Child Workflow docs/samples: a fan-out with one critical branch and several best-effort branches, where:
Promise.allOf(...)), so a best-effort failure can't take down a healthy critical branch, or vice versa.CancellationScopewhen the critical branch fails, instead of relying on the defaultParentClosePolicy(TERMINATE) —TERMINATEdelivers noCanceledFailure, so a child that's already dispatched work to a downstream system gets no chance to react before that work runs on, detached, with nowhere to report back to.Sagawith parallel compensation, repurposed for independent, isolated notifications rather than classic "undo what I did" semantics.The existing Fan-Out pattern doc covers homogeneous fan-out (identical chunks, all-or-nothing). This sample covers the heterogeneous case with partial-failure tolerance, which seems like a natural follow-up.
What's included
OnboardingWorkflow+ three child workflows (one critical, two best-effort)Startercovering all three outcomes (happy path, degraded, critical failure)Test plan
./gradlew :core:test --tests "io.temporal.samples.resilientfanout.OnboardingWorkflowTest"— 3/3 passing./gradlew spotlessCheck— cleanHappy to adjust scope/naming/domain if this isn't the direction you'd want for this pattern — opening this as a starting point for discussion.