title: Check for the existence of a Kafka topic programatically in Java
body: <p>How can I know if a topic has been created in a Kafka cluster, programatically, <em>without</em> using CLI tools, and before trying to produce into the topic?  </p>
  
  <p>I'm running into a problem where the topic doesn't exist, and our application is trying to produce to a non-existent topic, but it's only notified after 90 seconds (metadata timeout).  I'd like to know if there is a way to know, if the topic exists or not, from within Java code, so that we can check that before actually attempting to send the message.  I guess I could look at the code that the Kafka CLI utils uses, but I was wondering if maybe there's an API or an easier way that I may have missed.</p>