A KTable is Kafka Streams’ table abstraction for stateful processing: it represents the current value associated with each key rather than an entire event history. Incoming records update that state, making the abstraction useful when the final state matters more than the sequence of events. section 8.1.3 section 8.3.2
The state is backed by a changelog topic. Kafka Streams uses a compacted topic that retains the latest value for each key, supporting recovery and synchronization without preserving the full history. A table can be converted with toStream() when state changes must be emitted as continuous updates. section 8.3.2
KTables shape several architectural decisions:
- Use a table when records represent independently changing state, such as customer profiles, rather than only an event sequence. section 8.3.7
- Treat table-to-table joins differently from stream-table joins: updates to either table can trigger a new result, and no time window is required. section 8.3.7
- Account for repartitioning and state stores when keys must be aligned before aggregation or joining. section 8.3.7
Keeping a Customer 360 view current
A stream-table join between Transactions and Profiles can leave the aggregate stale: a profile update produces no output unless another transaction arrives. Aggregating transactions into a KTable and joining it with the Profiles KTable makes updates to either side produce a new Customer 360 result. section 8.3.7
Figure 8.15 A pipeline design using Kafka Streams. The source topics, Profiles and Transactions, serve as input streams, while Customer360-enriched is the output topic. Kafka Streams automatically creates intermediate topics for operations like repartitioning and changelog management. Both source topics are converted into tables using state stores, and the resulting tables are joined to produce the enriched output.
Shows the Profiles and Transactions topics converted into tables, joined through state stores, and emitted as Customer360-enriched output, with intermediate topics managed by Kafka Streams. section 8.3.7


