I am trying to understand behavior of kafka streams related to offset commit. Streams commit offset manually as auto commit is set to "false
" in Streams. What if I keep commit.interval.ms = 0
, whether streams will work correctly?
If you set commit.interval.ms = 0
Kafka Streams will commit "as soon as possible". In the implementation, there is a poll-process-loop that checks if a commit is required. If you set commit.interval.ms = 0
this check will evaluate to true
every time and thus commit will happen each time.
When the commit condition is checked is an internal implementation detail and there is no public contract how ofter the condition is checked. Note, it's not recommended to commit too frequently because it put additional load on Kafka Streams client and the brokers because committing is a sync operation and not for free.
From the comment:
We want to check whether we can store commits in external db..so we want to know can we achieve offset commit management solely on db side
Using Streams API, you cannot store offsets in an external DB. Kafka Streams uses Kafka's group management and commit API and you cannot change this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With