Compacted topic
A compacted topic is a Kafka topic whose log compaction retains the latest record for each key while allowing obsolete records to be removed.
Kafka for Architects
A compacted topic is a Kafka topic configured to retain at least the latest record associated with each non-null key.
- How it is used
- Stores recoverable current state for keyed configuration, profiles, changelogs, balances, or prices.
- How deep it goes
- Explains retention semantics, key partitioning, sequential reads, delayed cleanup, and consumer-visible older records.
- Examples
- Uses account balances, customer profiles, configuration data, changelogs, and current product prices.
- What you can do after
- Operate/configure a topic for current keyed state while evaluating sequential replay, delayed cleanup, and storage trade-offs.
Kafka Streams in Action, Second Edition
A compacted topic is a Kafka topic whose log retains the latest record for each key rather than retaining every historical record indefinitely.
- How it is used
- Supports retaining recoverable latest state for keyed event streams and Kafka Streams state-store changelogs.
- How deep it goes
- Explains key-based cleanup, background log cleaning, configuration, tombstones, and combined policies, while deferring broader compaction details.
- Examples
- Uses stock ticker prices, duplicate keyed updates, tombstones, and a Kafka Streams changelog configuration.
- What you can do after
- Configure Kafka topics with compaction and choose tombstones or combined cleanup policies for keyed state retention.
Read how Kafka Streams in Action, Second Edition explains compacted topic →
What to know first
- topicA topic is a named channel or category that groups messages or records for publication and delivery to interested consumers.
- messageA message is a discrete unit of information or data communicated between participants or software components, often represented as a structured record.
Related concepts
- changelogincludes · A changelog topic is a Kafka topic that records state-store updates so processing state can be recovered or restored.
- Apache Kafkakind of · Apache Kafka is a distributed event-streaming platform for publishing, storing, and processing streams of records.
- topickind of · A topic is a named channel or category that groups messages or records for publication and delivery to interested consumers.
- partition keyuses · A partition key is a value or attribute used to determine the partition to which a data item, record, or message is assigned or routed.
- migrationused by · A migration is a planned process of moving or adapting data, software, or system state from one environment, version, or representation to another.
Questions about compacted topic
What is compacted topic?
A compacted topic is a Kafka topic whose log compaction retains the latest record for each key while allowing obsolete records to be removed.
Which Manning books explain compacted topic?
Kafka for Architects and Kafka Streams in Action, Second Edition.
What should I know before learning compacted topic?
Manning books that teach compacted topic usually introduce topic and message first.
What kinds of compacted topic are there?
Kinds of compacted topic include changelog.
What is compacted topic a kind of?
Compacted topic is a kind of Apache Kafka. Apache Kafka is a distributed event-streaming platform for publishing, storing, and processing streams of records.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

