Update
Since Apache Kafka 2.1, offsets won’t be deleted as long as the consumer group is active, independent if the consumers commit offsets or not, ie, the offset.retention.minutes
clocks only starts to tick when the group becomes empty (in older released, the clock started to tick directly when the commit happened).
Original Answer
Kafka, by default deletes committed offsets after a configurable period of time. See parameter offsets.retention.minutes
. Ie, if a consumer group is inactive (ie, does not commit any offsets) for this amount of time, the offsets get deleted. Thus, even if the consumer is running, if it does not commit offsets for some partitions, those offsets are subject to offset.retention.minutes
.
If you start a consumer, the following happens:
- look for a (valid) committed offset (for the consumer group)
- if valid offset is found, resume from there
- if no valid offset is found, reset offset according to
auto.offset.reset
parameter
Thus, if your offsets got deleted and auto.offset.reset = latest
, you consumer will not poll anything until new data is added to the topic. If auto.offset.reset = earliest
it should consume the whole topic.
See this JIRA for a discussion about this https://issues.apache.org/jira/browse/KAFKA-3806 and https://issues.apache.org/jira/browse/KAFKA-4682