With the Java Kafka Consumer seek()
function it requires we pass in the TopicPartion
and Offest
. However, I thought this seek method would take a collection of subscribed TopicPartitions for my consumer.
Here is my example I am trying to handle.
Consumer A is subscribed to topic "test-topic" partitions 1 and 2. I read messages from each partition when I call poll()
. I process some messages but my application gets an exception. I do not call commitSync()
. Now I want to rewind to those offsets that I retrieved on my last poll()
and try to reprocess them. So how should I do this? Do I need to go through the last committed offsets for each topic partition and call seek()
for each partition? Will calling seek()
multiple times only accept the last seek()
that is called? As I said I want to make sure my consumer goes back for all partitions so I do not lose any data on any assigned partitions.