Kafka Streams: use the same `application.id` to consume from multiple topics : <p>I have an application that needs to listen to multiple different topics; each topic has separate logic for how the messages are handled. I had thought to use the same kafka properties for each KafkaStreams instance, but I get an error like the one below. </p>

<p><strong>Error</strong></p>

<pre><code>java.lang.IllegalArgumentException: Assigned partition my-topic-1 for non-subscribed topic regex pattern; subscription pattern is my-other-topic
</code></pre>

<p><strong>Code</strong> (kotlin)</p>

<pre><code>class KafkaSetup() {
    companion object {
        private val LOG = LoggerFactory.getLogger(this::class.java)
    }

    fun getProperties(): Properties {
        val properties = Properties()
        properties.put(StreamsConfig.APPLICATION_ID_CONFIG, "my-app")
        return properties
    }

    private fun listenOnMyTopic() {
        val kStreamBuilder = KStreamBuilder()
        val kStream: KStream&lt;String, String&gt; = kStreamBuilder.stream("my-topic")

        kStream.foreach { key, value -&gt; LOG.info("do stuff") }

        val kafkaStreams = KafkaStreams(kStreamBuilder, getProperties())
        kafkaStreams.start()
    }

    private fun listenOnMyOtherTopic() {
        val kStreamBuilder = KStreamBuilder()
        val kStream: KStream&lt;String, String&gt; = kStreamBuilder.stream("my-other-topic")

        kStream.foreach { key, value -&gt; LOG.info("do other stuff") }

        val kafkaStreams = KafkaStreams(kStreamBuilder, getProperties())
        kafkaStreams.start()
    }
}
</code></pre>

<p>I found this <a href="https://groups.google.com/d/msg/confluent-platform/0dUszvmfkyQ/UQO1uwbQCAAJ" rel="noreferrer">reference</a> that suggest that you can not use <code>application.id</code> for multiple topics, however I am finding it hard to find reference documentation to support that. The <a href="https://kafka.apache.org/0110/documentation.html#streamsconfigs" rel="noreferrer">documentation</a> for <code>application.id</code> states:</p>

<blockquote>
  <p>An identifier for the stream processing application. Must be unique within the Kafka cluster. It is used as 1) the default client-id prefix, 2) the group-id for membership management, 3) the changelog topic prefix.</p>
</blockquote>

<p><strong>Questions</strong></p>

<ol>
<li>What does this error mean, and what causes it. </li>
<li>Given that you can have multiple instance of you app running with the same id to consume from multiple topic partitions, what does <em>"Must be unique within the Kafka cluster"</em> mean?</li>
<li>Can you use the same Kafka streams <code>application.id</code> to start two <code>KafkaStreams</code> that are listing on different topics? and if so, how?</li>
</ol>

<p><em><strong>Details:</strong> kafka 0.11.0.2</em></p>
