Re: Consumer not receiving messages when subscribing to a topic but can receive message when assigning a partition
Hi Ranganath,
If messages are only received when a specific partition is assigned, but
not when subscribing via a consumer group. This is because:
--> The consumer config has enable.auto.commit=false, but no manual offset
commits are being made (commitSync() is missing). As a result, Kafka
thinks there are no new messages to consume for the group.
--> Also, if offsets were already committed earlier, --from-beginning has
no effect unless the offsets are reset.
*Recommended fixes:*
1.
Add kafkaConsumer.commitSync() after polling records in Java code.
2.
temporarily set enable.auto.commit=true to allow auto commits.
3.
For CLI, reset the group offset using:
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group
console --topic input --reset-offsets --to-earliest --execute
Regards,
Sisindri M.
On Thu, Jun 26, 2025 at 1:03āÆAM Samudrala, Ranganath [USA]
<Samudrala_Ranganath@bah.com.invalid> wro...