Stream ↔ table duality
The two abstractions
- KStream — an unbounded sequence of records; events.
- KTable — a changelog-backed view of the latest value per key; state.
Move from stream → table by aggregation. Move from table → stream by toStream(). Both are backed by Kafka topics, so failover is just 'replay the changelog'.
We use a Python-friendly Faust-style snippet here for visual brevity — production Kafka Streams is JVM-native; the shape of the program is identical.