Stream Processing

Batch vs Streamingstreamingwhen continuous processing is worth its extra complexity. Event Time, Windows and Watermarksstreaminghow engines group an endless stream and decide when results are complete. Exactly-Once Semanticsstreamingwhat the guarantee really covers and how checkpoints and transactional sinks provide it. Spark Structured Streamingstreamingmicro-batch streaming with the Spark DataFrame API. Apache Flinkstreamingarchitecture, DataStream and SQL APIs, state, checkpoints and a Kafka windowing example. Kafka Producer and Consumerpipelineswriting to and reading from the event log in Python. PySpark Data Streamingstreaming ioSpark Structured Streaming basics. AWS Kinesis Data Streamsserverlessthe managed AWS event log. Kinesis Data Firehoseanalyticsmanaged delivery of streams into S3 and warehouses. Change Data Capturepipelinesturning database changes into streams. Apache Paimontable formatsa lake table format designed for streaming writes.

Stream processing turns data pipelines from nightly jobs into continuously updating systems. This section covers the event log, the processing engines and the concepts — time, windows, state and guarantees — that tie them together.


1. Overview

Stream processing means computing over data continuously as it arrives rather than in scheduled batches. Instead of "load yesterday's orders at 2 a.m. and aggregate them", a streaming pipeline updates totals within seconds of each order. The input is treated as unbounded: there is no last row, so results are produced incrementally and the system must decide when a window of time is complete enough to emit an answer.

A Streaming Data Platform Apps / CDC database changes Devices / logs events, metrics Event log Kafka, Kinesis Stream processor Flink, Spark, KStreams Lakehouse Iceberg, Delta Serving DB OLAP, KV store Alerts / APIs real-time actions The log decouples producers from consumers and allows replay

Most streaming platforms share the shape above. Producers — application events, change data capture (CDC) from OLTP databases, devices and logs — append to a durable, partitioned event log such as Apache Kafka or Amazon Kinesis. The log decouples producers from consumers and keeps data for replay. A stream processor reads the log, filters, joins, aggregates and enriches events while maintaining state, then writes results to lakehouse tables, low-latency serving stores, or alerting systems.

2. Core Concepts

3. Choosing an Engine

NeedGood fitWhy
Complex stateful logic, low latency, event timeApache FlinkNative event-at-a-time engine with large keyed state and exactly-once checkpoints
Team already on Spark / DatabricksSpark Structured StreamingSame DataFrame API for batch and stream; micro-batch latency is often acceptable
Kafka-to-Kafka microservicesKafka StreamsA library, not a cluster; state backed by Kafka topics
Managed AWS ingestion and deliveryKinesis Data Streams and FirehoseServerless, minimal operations; limited transformation
Hourly freshness is fineScheduled batchSimpler to build, test and backfill

The last row matters: streaming adds operational complexity, so choose it when freshness changes a decision, not by default. Many teams use incremental batch every few minutes as a middle ground.

4. Suggested Learning Path

Start with Batch vs Streaming to decide whether you need streaming at all, then the event log (Kafka producers and consumers) to understand partitions, offsets and consumer groups. Then learn CDC, because most business streams start as database changes. Read Event Time, Windows and Watermarks and Exactly-Once Semantics next, since every engine builds on those ideas. Then move to a processor: Spark Structured Streaming if you already know Spark, Flink if you need true low latency or complex state. Finish with where results land: lakehouse table formats for history and OLAP stores for live dashboards. Throughout, keep data quality in mind; a streaming bug corrupts data continuously rather than once a night.