Semantics for Apache Kafkas
Kafka delivery semantics describe how many times a message may be processed: at most once, at least once or exactly once. They depend on producer acknowledgements, retries, idempotent producers, transactions and when a consumer commits offsets, so choosing them is a trade-off between safety, duplicates and speed.
Stage: Key Concepts · Part of the Apache Kafka roadmap · Last reviewed 19 November 2026
What to learn in Semantics
- Compare at-most-once, at-least-once and exactly-once delivery
- Set acks and retries on a producer for durability
- Enable the idempotent producer and explain what it prevents
- Decide whether to commit offsets before or after processing
- Describe how transactions provide exactly-once processing between topics
Semantics interview questions
What does acks=all mean for a Kafka producer?
The leader waits until all in-sync replicas have written the record before acknowledging it. Together with min.insync.replicas, this prevents data loss if the leader fails right after the write. It adds latency compared with acks=1, which only waits for the leader.
How can a consumer process a message twice?
If the consumer processes a record but crashes before committing its offset, it restarts from the last committed offset and reads the record again. This is at-least-once behaviour. Make processing idempotent, or store results and offsets together, to handle duplicates.
Where Semantics fits in the Apache Kafka roadmap
Semantics belongs to the Key Concepts stage (beginner level), which takes about 20 hours. The log.
Other units in this stage
Back to the full Apache Kafka roadmap