title: How to get the processing kafka topic name dynamically in Flink Kafka Consumer?
body: <p>Currently, I have one Flink Cluster which wants to consume Kafka Topic by one Pattern, By using this way, we don't need to maintain one hard code Kafka topic list.</p>
  
  <pre class="lang-java prettyprint-override"><code>import java.util.regex.Pattern;
  import org.apache.flink.streaming.api.datastream.DataStream;
  import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer010;
  ...
  private static final Pattern topicPattern = Pattern.compile("(DC_TEST_([A-Z0-9_]+)");
  ...
  FlinkKafkaConsumer010&lt;KafkaMessage&gt; kafkaConsumer = new FlinkKafkaConsumer010&lt;&gt;(
            topicPattern, deserializerClazz.newInstance(), kafkaConsumerProps);
  DataStream&lt;KafkaMessage&gt; input = env.addSource(kafkaConsumer);
  </code></pre>
  
  <p>I just want to know by using the above way, How can I get to know the real Kafka topic name during the processing?
  Thanks.</p>
  
  <p>--Update--
  The reason why I need to know the topic information is we need this topic name as the parameter to be used in the coming Flink sink part.</p>