There is a script kafka-topics.sh which calls kafka.admin.TopicCommand. I think you could probably call that same class from your application if you figure out which jars are needed. When I do testing I'll clear out queues by setting the retention time to a second and then wait for kafka to remove all the messages. If you turn on the ability to delete topics, you can also then delete them.
-Dave -----Original Message----- From: Demian Calcaprina [mailto:calcacue...@gmail.com] Sent: Monday, October 24, 2016 8:31 AM To: users@kafka.apache.org Subject: Removing kafka topic contents from Java Hi Guys, Is there a way to remove a kafka topic from the java api? I have the following scenario: We have a subscription service, which returns responses to subscribed clients through kafka topic. Per subscription, we create a new kafka topic and send the data by publishing in this new topic. And, when the subscription ends, this topic is not needed anymore, so I would like to purge it so that it does not store data it will not be used anymore. Does it make sense? Thanks! Demian This e-mail and any files transmitted with it are confidential, may contain sensitive information, and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error, please notify the sender by reply e-mail immediately and destroy all copies of the e-mail and any attachments.