← Lessons

quiz vs the machine

Gold1490

Concurrency

The Flow Control in Reactive

How demand propagates through an operator chain.

5 min read · core · beat Gold to climb

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.

Check yourself

Answer to earn rating on the learn ladder.

1. In which direction does demand flow in a reactive pipeline?

2. Why might a filter operator request more than it was asked for?