Junior — Middle
Which Kafka component ensures prevention of re-reading the same messages?
sobes.tech AI
Answer from AI
In Kafka, prevention of re-reading the same messages is ensured by the mechanism of offsets and their management on the consumer side.
Each message in a partition has a unique offset — a sequential number. The consumer tracks which offset it has already read and commits it. When restarted, the consumer begins reading from the last committed offset, thus avoiding re-reading already processed messages.
Therefore, the component responsible for preventing re-reading is the consumer itself, which manages the commit offsets.