1
votes

I am working on utility to delete kafka topics not being used for somedays. I am able to delete topics using kafka Admin/Consumer Api. My Ask is how to identify when topic has received last message?

1

1 Answers

0
votes

You can use GetOffsetShell tool/class to list beginning and ending offsets of topics.. If they match, topic is empty. You can also get offsets for a specific timestamp (for Kafka versions 0.10.2+, I think)

Or you can SSH to the brokers and iterate the log directories / dump log segments to see if they are empty / filter them by time.

Neither approach will guarantee that any producer will be actively connecting to the topic you're trying to delete and trying to send a message, which would invalidate your search