Cookbook
Cookbook
Recurring patterns, each worked through once so you don’t have to derive it under deadline. Every entry follows the same structure: the problem, the pattern that solves it (with a concrete JSON example), why this shape works, common variations, and see also pointers into the Reference for the formal semantics.
The entries assume the vocabulary of the tour; read that first if a construct here is unfamiliar.
In this section
- Polling with timeout —
LoopandTimeoutcomposed around repeated status checks against a slow operation. - Fan-out and partial success —
Gatherwith an explicit completion policy, and shapingstep.resultswhen some dispatches fail. - Retry composition — multi-policy
Retry, whereTimeoutsits relative to it, and three-layer stacks. - Pagination accumulation —
Loop’s carried value driving a cursor, withvarsaccumulating pages. - Saga-style compensation —
catchrouting to compensation Steps that undo partial work, then re-raise. - Cleanup with
Finally— audit writes and resource release that run on every exit, including teardown. - Conditional middleware —
whenpredicates turning operational behavior into parameters. - Wrapping work in a subflow — the inline-Flow idiom for per-dispatch behavior, shared deadlines, and refactoring seams.