Kafka - Getting messages from the beginning of my subscribed topics

Hi anyone can help ? How can i get all messages from the beginning in all of my subscribed topics? I am using consumer.subscribe(pattern). I tried including ConsumerRebalanceListener but onPartitionsAssigned didnt get invoked at all.


Note you have to poll once before you can do this, in order to join the consumer group. consumer.poll(0) is the standard practice

I tried it and still couldn't get any messages. The log indicates that the consumer has subscribed to the topics.

Did you poll() again after seekToBeginning()?

Yes I did and it didn’t return any messages on both. seektobeginning() works with a single topic and using consumer.assign(). I followed this as well https://stackoverflow.com/questions/53089007/apache-kafka-seek-and-assignment-reliable-read-from-beginning but no success so far.