What determines Kafka consumer offset?

I am relatively new to Kafka. I have done a bit of experimenting with it, but a few things are unclear to me regarding consumer offset. From what I have understood so far, when a consumer starts, the offset it will start reading from is determined by the configuration setting auto.offset.reset (correct me if I am wrong).

Now say for example that there are 10 messages (offsets 0 to 9) in the topic, and a consumer happened to consume 5 of them before it went down (or before I killed the consumer). Then say I restart that consumer process. My questions are:

  1. If the auto.offset.reset is set to earliest, is it always going to start consuming from offset 0 ?

  2. If the auto.offset.reset is set to latest, is it going to start consuming from offset 5 ?

  3. Is the behaviour regarding this kind of scenario always deterministic ?

Please don’t hesitate to comment if anything in my question is unclear.

3 Answers
3

Leave a Comment