Reputation: 289
We have pushed messages onto kafka queues 2 days back and the retention is set to 2 days so its going to expire today . Is there any way of knowing exactly when kafka queues are empty/not having any data in them?
I am a beginner in Hadoop system so I don't know if there is any command to find this/easy way to verify the empty queues
Upvotes: 0
Views: 5599
Reputation: 327
After you create consumer, before assigning any partition to it check:
If consumer.position(topicPartition)
is equal to consumer.endOffsets(List.of(topicPartition))
- then there is nothing to consume.
Upvotes: 0
Reputation: 62350
You can write a own little tool using KafkaConsumer
laveraging seekToEnd()
, seekToBeginning()
, and position()
to get min and max offsets per partition. If both match for all partitions, the topic is empty.
Upvotes: 1