user1578872
user1578872

Reputation: 9028

Kafka10 auto.commit.interval.ms property

I have set auto commit interval to 5 secs. What if the poll() method takes 10 secs to complete processing.

Will it still commit at every 5 secs or waits until the next poll()?

Thanks

Upvotes: 0

Views: 1317

Answers (1)

amethystic
amethystic

Reputation: 7089

It cannot be guaranteed to commit every 5 seconds even if you set auto.commit.interval.ms to 5 seconds. Technically, I agree with your statement of waits until the next poll.

Handling offset commit will be checked first in a single poll round. In fact, polling coordinator events is the very beginning thing that KafkaConsumer#poll does, which including ensuring coordinator's aliveness, consumer's successful joining group and also taking care of auto-commit-offset things. During this check, coordinator decides whether it should commit offsets. And it is executed from within a same thread where poll is called, so a precise 5-second interval cannot be achieved and until the next poll coordinator does not handle those things.

Upvotes: 1

Related Questions