Kafka Consumer not consuming messages after application restart

I have a Java application that consumer messages from a Kafka topic. Using following kafka client dependency.


Once restarted, application stops consuming messages from the topic, just returns empty after poll timeout is expired. If the change the consumer group and restart the application, messages are picked until next restart. I have 10 partitions in the topic and if the describe the consumer group a lag is shown for the partition where data is available. If i recreate the topic with single partition, everything works fine. After seeing [KAFKA-8950] KafkaConsumer stops fetching - ASF JIRA i have upgraded the kafka-client to latest but still facing the issue.

Using following configuration, everything else is default

group.id: group-1
fetch.min.bytes: 1
fetch.max.wait.ms: 60000
max.poll.records: 1
max.poll.interval.ms: 120000
auto.offset.reset: earliest
enable.auto.commit: false

Seeing this in logs, still messages are not picked up.

Setting offset for partition rawData-tp-3 to the committed offset FetchPosition{offset=6, offsetEpoch=Optional[0], currentLeader=LeaderAndEpoch{leader=Optional[wn3.b3fteyj4w3xuzpvo3wsrfzzila.ax.internal:9092 (id: 1002 rack: /rack0)], epoch=0}}

Consumer is created as following

kafkaConsumer = new KafkaConsumer<>(kafkaProperties);
kafkaConsumer.subscribe(Collections.singletonList(topic), new CustomConsumerRebalanceListener());

CustomConsumerRebalanceListener just prints the partitions assigned/revoked