I am trying to write a script with kafka-python, that will count number of messages in Kafka topics. For topics with delete policy I used difference between end_offset and beginning_offset (and sum it up across partition for the topic), but with compacted topics this way can be called an estimation at best.
So is there any way to precisely count messages for compacted topic relatively fast? (I see the only way with using polling, but it takes minutes, maybe there is any other ways to do it)