1. What is a “stream”?


2. Key roles & vocabulary

Term Plain meaning Analogy
Producer (publisher) Code that emits events Web server writing access log lines
Consumer (subscriber) Code that reads events Fraud detector that reacts to payments
Topic / stream Named category of events “purchases”, “temperature-sensor-42”
Event encoding How data is stored on the wire (JSON, Avro, …) File format for each record

3. The speed-mismatch problem

Producers might out-run consumers. Systems must pick ONE strategy:

  1. Drop old messages (best-effort telemetry).
  2. Buffer messages somewhere (queue or log).
  3. Back-pressure producers (block or slow them so consumers catch up).

4. Message transport options

4 a. Direct producer → consumer

4 b. Broker in the middle