Skip to content
Exercise · Kafka reliability · lesson 6 of 7

Exercise: state from a compacted topic

A compacted topic keeps the last value for each key, so a state can be rebuilt from it: product prices, user profiles, settings. On startup a service reads such a topic from the beginning and builds a table in memory. The broker in this exercise is a model in the tests file, not a real Kafka: the records of a compacted topic with gaps in the offsets, the way a consumer reads them.