0x822a5b87
0x822a5b87

Reputation: 517

How to consume kafka frome the max offset when the offset is exist?

I've read the documentation and i found the config "auto.offset.reset" :

What to do when there is no initial offset in ZooKeeper or if an offset is out of range:

the question is that I used to consumer kafka with a group id and I want to keep the group id but abandon the old message.

How can I do this ?

Upvotes: 1

Views: 417

Answers (1)

Sebastian
Sebastian

Reputation: 17443

You can try to do this in your consumer in ConsumerRebalanceListener.onPartitionsAssigned:

public void onPartitionsAssigned(Collection<TopicPartition> partitions) {   
    kafkaConsumer.seekToEnd(partitions);
}

Upvotes: 2

Related Questions