Demand flows upstream
In a reactive pipeline, items flow downstream from source to sink, but demand flows upstream from sink to source. The consumer at the bottom asks for items, and that request travels back up to the producer.
Operators and demand
Each operator decides how to translate downstream demand into upstream demand:
- A map passes demand straight through, one in one out.
- A filter may request more than asked because some items get dropped.
- A buffer may request many to fill a window while emitting fewer.
This makes the chain self regulating. A slow sink quietly throttles the whole pipeline up to the source.
Why it matters
Without coordinated flow control, a fast source plus a slow sink overflows the operators in between. Propagating demand end to end keeps memory bounded at every stage, not just at the consumer.
Key idea
Items flow downstream while demand flows upstream, and each operator maps downstream requests into the upstream requests it needs.