I am trying to use the High level consumer for batch reading the messages in the Kafka topic. During this batch read, my thread has to stop at some point.
Either, once all the messages in the topic are exhausted. or Get the max offset at the point when the messages are about to be read and stop till that max offset is reached.
I tried to use the code at high-level-consumer but the iterator methods on the KafkaStream seems to be a blocking call and waits till another messages comes in.
So 3 questions,
How do i know that there are no more messages to be read from the topic?
If i have an answer to the above question, how do i stop it from listening to the topic anymore?
Is there a way to find the maximum offset when the batch read starts (i think simple consumer can do this) and make the high level consumer stop at that point?