Advanced Streaming

Part V · Chapter 22 — windowing, joins, replay fanout, FSM scans, and transducers.

Part IV introduced pull-based Stream processing with chunks, sinks, and backpressure. This chapter covers multi-stream patterns: grouping events into windows, joining live sources, replaying history to fanout branches, stepping simple state machines over elements, and applying composable transducers.

Module map

ModuleRole
windowTumbling, sliding, and session windows
joinmerge, combine_latest, keyed_join
replaybroadcast_with_replay fanout
state_scanOptional-output FSM step
transducervia_transducer / transduce_items

When to use what

  • Windows — aggregate or batch events by count, time, or session gaps.
  • Joins — correlate two live sources (merge for fair interleave, combine_latest for dashboards).
  • Replay fanout — same as broadcast, plus a retained tail buffer per branch.
  • state_scan — emit only on FSM transitions (contrast with scan which emits every step).
  • Transducers — reusable map/filter pipelines (API-compatible with id_effect_optics::Transducer).

See the section pages for examples and tests in each module.