Search code examples
apache-kafkaproducer-consumerredpanda

How does a Kafka Consumer keep track of processed messages if auto commit happen less often than poll?


So if a Kafka Consumer has auto commit enabled with a commit interval of 5 sec, and we consume a batch every 1 second ...

... will the consumer process messages multiple times before the auto commit has been completed?


Solution

  • If you marked the batch processed, it will commit to the partition in the cluster every 5 sec. The consumer issues the next batch poll to get the next set of messages, so it would start from the next offset. Unless there is a error occurred, it's not likely to get the same batch of msg again.