Skip to content

Batch Strategy

Choose the batch primitive based on the shape of the problem, not on convenience.

NeedUse
Per-item statusmapItems(...)
Fail fast on the first bad itemmapAll(...)
Return every failuremapCollectErrors(...)
Aggregate existing Result[] fail fastcombine(...)
Aggregate existing Result[] and keep all failures (no successes on failure)combineAll(...)

Rule of thumb

  • validation screens usually want collect-all
  • write pipelines usually want fail-fast
  • keyed UI errors should stay keyed
  • existing Result[] should use combine or combineAll
  • combineAll(...) returns only the collected failures when any input fails