I am trying to write a java program that monitors the kafka consumer and end offset values and send alerts if it does not update for a given period of time. So i was using the consumer.getCommitedOffsets() method in the Kafka consumer API in java. But this does not seem to be the correct consumer offset value or maybe not the consumer offset for this consumer group. Can anyone tell me how to get the value of consumer offsets in kafka for a consumer group and particular topic?
Have you tried using consumer.position(TopicPartition partition)? or run the following script from your java program. You can also run the script with zookeeper instead of bootsrap-server.
kafka-consumer-groups.sh --bootstrap-server <broker-host>:9092 --new-consumer --group groupname --describe