Start here
Structured Streaming is the part of Spark that works on data that never stops arriving. Orders, clicks and sensor readings are examples.
You write the same DataFrame code you already know. Spark runs it again and again on the new rows.
You met the streaming ideas in four data-pipeline chapters. They are "Batch vs Streaming vs Micro-Batch", "Streaming Architecture Fundamentals", "Stream Processing" and "Delivery Guarantees & Ordering". Here you use them in Spark.
This chapter uses the shop stream. Orders 110 to 114 and 150 and 151 arrive on 2026-01-22. Spark reads them from a Kafka topic called orders.
The chapter has nine parts.
- The model: a stream is a table that keeps growing.
- Sources: where the rows come from.
- Sinks: where the results go.
- Triggers: when Spark runs.
- Output modes: which rows Spark writes each time.
- The checkpoint: how a query survives a crash.
- foreachBatch: writing with your own code.
- Exactly-once from end to end.
- Monitoring a running query.
Windows and watermarks are in the next chapter, "Event-Time, Windows, Watermarks & Stateful Streaming".
