I'm new to Kafka. currently, I have created a java consumer on a Kafka topic. What I want is to get only the new messages when I start my java application.
After checking on the internet I found that I can do that by setting the property:
auto.offset.reset: earliest, but we don't want to use that.
Also after doing some research I found that maybe we can do that by updating the consumer offset to the earliest one.
Can anyone help to know how I can do that, please?
Note that I'm using KStream to subscribe to the topic. Kafka version 2.4.0 subscribe source code:
StreamsBuilder sb = new StreamsBuilder();
sb.stream("topic").foreach((t, u) -> {...})