Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get Kafka unconsumed messages count in Java

We would like to know the messages count which are not yet consumed and acknowledge by Kafka Consumer for a given Kafka topic.

Is there any way we can get the count of Unconsumed Kafka messages from a given Topic (Topic is having 10 partitions) in Java ??

like image 842
Chandra Duddukuri Avatar asked May 18 '26 09:05

Chandra Duddukuri


1 Answers

kafka consumers have a per-partition "records-lag" metric (introduced in kip-92). you can sum those metrics for all partitions of your topic, and get a figure for unconsumed messages

like image 181
radai Avatar answered May 19 '26 23:05

radai



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!