resonate-recursive-fan-out-pattern-java

Installation
SKILL.md

Resonate Recursive Fan-Out Pattern — Java

Prerelease note. resonate-sdk-java is published on Maven Central — pin io.resonatehq:resonate-sdk-java:0.1.1. The API mirrors the Python SDK and may change before a stable 1.0. Requires Java 21+ (virtual threads, a feature generally available in Java 21). Every code block here is compile-verified against 0.1.1 and drawn from the example-fan-out-fan-in-java / example-recursive-factorial-java repos and develop/java.mdx (docs PR #230).

Overview

Recursive fan-out dispatches multiple child invocations in parallel, awaits them individually, and optionally recurses deeper. The Java expression is a two-loop pattern: a dispatch loop builds a List<ResonateFuture<T>>, then a separate await loop reads each result. Mixing dispatch and await serializes the children — the single most common mistake.

For the language-agnostic mental model (promise deduplication, load-balancing, detached vs. result-gathering), see resonate-recursive-fan-out-pattern-typescript.

When to use

  • Batch processing where items are independent and each needs durability
  • Map-reduce shaped workflows (fan out N workers, aggregate results)
  • Recursive tree / graph traversal with dynamic depth
  • Any case where a crash mid-fan-out must resume, not restart from zero

Dispatch-then-await shape

Installs
1
GitHub Stars
6
First Seen
Aug 10, 2026
resonate-recursive-fan-out-pattern-java — resonatehq/resonate-skills