Senior
What happens to a message in Kafka after it has been read by a Consumer?
sobes.tech AI
Answer from AI
In Apache Kafka, a message is not deleted from the topic after it has been read by a Consumer. Kafka retains messages for a specified retention period or until a certain log size is reached, regardless of whether they have been read.
The Consumer tracks its position in the topic using offsets. After reading a message, the Consumer can commit the offset to indicate that the message has been processed. This allows it to resume reading from the correct position upon restart.
Thus, the message remains in Kafka until the retention period expires, and the Consumer manages which messages it has already read and processed.