I\'m new to Kafka and working on a prototype to connect a proprietary streaming service into Kafka.
I\'m looking to get the key of the last message sent on a topic a
The problem is on line final long offset = consumer.committed(partition).offset(), as link api refers committed method is to get the last committed offset for the given partition, i.e: the last offset your consumer tell kafka server that it had already read.
So, definitely you will got messages replayed, because you always read from specific offset.
As I think I only have to remove the first for block.