title: Delete Messages from a Topic in Apache Kafka
body: <p>So I am new to working with Apache Kafka and I am trying to create a simple app so I can try to understand the API better. I know this question has been asked a lot here, but how can I clear out the messages/records that are stored on a topic? </p>
  
  <p>Most of the answers I have seen say to change the message retention time or to delete &amp; recreate the topic. Neither of these are options for me as I do not have access to the server.properties file. I am not running Kafka locally, it is hosted on a server. Is there a way to do do it in Java code maybe or something? </p>