Start here
In the last chapter, the shop sent each order as an event. Something must carry those events from the shop to the code that uses them. This chapter shows how that works.
What you already know
- A stream is a feed that sends each event as it happens.
- Event time is when the order was placed. Processing time is when your pipeline sees it.
- A late event arrives after events that happened later than it. A window is a block of time. A watermark decides when a window is done.
- At-least-once means an event can arrive twice. A MERGE on order_id makes a repeat safe.
- Kafka stores events in order. Lag is how far a reader is behind.
What you will learn
- The parts of a streaming system, and why it keeps a log.
- How long the log keeps events, and how replay works.
- Partitions, and why order exists only inside one partition.
- Offsets and consumer groups.
- What a stream processor and a sink do.
- Consumer lag and backpressure.
- The producer and consumer settings that decide if data is lost.
We use the same shop and the same made-up day, 2026-01-22. Orders 110 to 114 are the same. Orders 150 and 151 are new.
This table lists the seven orders in the order they arrive:
| order_id | customer_id | amount | Event time | Arrives |
|---|---|---|---|---|
| 110 | 2 | 30.00 | 10:02 | 10:02 |
| 111 | 5 | 9.00 | 10:04 | 10:04 |
| 112 | 3 | 20.00 | 10:06 | 10:06 |
| 113 | 1 | 12.00 | 10:04 | 10:07 (late) |
| 114 | 4 | 7.50 | 10:08 | 10:08 |
| 150 | 2 | 18.00 | 10:09 | 10:09 |
| 151 | 1 | 8.00 | 10:10 | 10:10 |
