Windowing and Stateful Aggregations in Kafka Streams
Learn to perform time-windowed aggregations and manage state stores in Kafka Streams to compute running counts, sums, and metrics over event streams.
Stateful vs Stateless
Operations like map and filter are stateless. Aggregations such as counting or summing require state that persists across records.
Kafka Streams manages this state for you in local state stores.
Grouping a Stream
Before aggregating you group records by key with groupByKey or groupBy.
KGroupedStream<String, Order> grouped =
orders.groupBy((key, order) -> order.getCustomerId());All lessons in this course
- Introduction to Kafka Streams
- Stream Processing with KStream & KTable
- Building a Simple Stream Application
- Windowing and Stateful Aggregations in Kafka Streams