liveBook · Manning

Streaming table

As explained in Apache Kafka in Action

A stream processing table is a continuously updated key-value representation of current state derived from records in a stream.

A streaming table is a continuously updated key-value representation of current state derived from records in a stream. It complements a data stream: the stream captures changes, while the table makes the latest state queryable without consulting an external database. section 12.4.1 section 12.7

Unlike a relational table, it has only a key and a value. Creating a table from a topic reads records from the beginning, updates each key’s intermediate state, and stores that state. In Kafka Streams, builder.table("topic") creates a KTable; Flink provides Tables. section 12.4.1

Operationally, a streaming table involves several linked concerns:

  • Partitioning means each application instance knows only part of the table. section 12.4.1
  • Local storage, commonly RocksDB, holds intermediate state for fast key-value access. section 12.4.1
  • A compacted changelog topic records state changes so the table can recover after a crash. section 12.4.1
  • Aggregations such as count() update table values as new records arrive; other application components can query the results or use them in joins. section 12.4.1 section 12.7

Current product or account state

A topic containing product records can become a table whose value for each product key represents its latest state. Similarly, an account transaction aggregation can maintain the current total for each account. New records update the table, while the changelog preserves those updates for recovery. section 12.4.1 section 12.7

Figure 12.6 We can convert streams into tables, and the transformation works in the opposite direction as well.
A green square with black text

AI-generated content may be incorrect.

Use the stream-to-table diagram to trace how continuous records become stored current state, and how the transformation can also run in reverse. section 12.4.1

How Apache Kafka in Action covers it

How deep it goes
Explains key-value structure, topic replay, partitioning, local state, changelog recovery, aggregations, and joins.
Examples
Uses product state, account transaction totals, count aggregations, topic compaction, and stream-table joins as concrete examples.
What you can do after
Apply it via Kafka Streams or Flink to derive, query, aggregate, join, and recover current state from topics.
How it connects
Connects streaming tables with data streams, Kafka Streams, Flink, key-value stores, aggregations, joins, partitions, and changelog topics.

Also explained in

Compare how 2 books explain streaming table →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Apache Kafka in Action. The section links point to the parts of the book it draws on.