8 The KTable API

This chapter covers

  • Changelog streams, the KTable, and the GlobalKTable
  • Aggregating records with a KTable
  • Enriching event streams with joins
  • Joining a KTable with another KTable

This chapter will introduce you to a new API in Kafka Streams, the Ktable. The KTable is an update or changelog stream. You’ve already used a KTable as any aggregation operations in Kafka Streams result in a KTable. The KTable is an essential abstraction for working with records with the same key. In a KStream, records with the same key are independent events. But in the KTable, a record updates the previous one with the same key.

Why is learning about an update stream necessary? Sometimes, you’ll only care about the latest entry for a given ...

Get Kafka Streams in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.