title: Multiple Consumers Spring Kafka
body: <p><em>Note to duplicate markers</em>: I <strong><em>DID</em></strong> check out the other question, but it does not answer my specific question below.</p>
  
  <p>So imagine I have a Kafka topic on a single server with only one partition. So it is much similar to a queue.</p>
  
  <p>Now lets assume I want 100 listeners waiting to accept values from the queue.
  So by design, if all 100 consumers are in a single group, the contents from the log (or queue here) will be distributed among the consumers. So the operation will be over in 1/100th of the time.</p>
  
  <p>The <strong>problem</strong> is that the Spring Kafka listener is only configured with the topic name.</p>
  
  <pre><code>@Service
  public class Consumer {
  
      @KafkaListener(topics = "${app.topic}")
      public void receive(@Payload String message,
                          @Headers MessageHeaders headers) {
          System.out.println("Received message="+message);
          headers.keySet().forEach(key -&gt; System.out.println(key+"-&gt;"+headers.get(key)));
      }
  }
  </code></pre>
  
  <p>I can seem to get Kafka to spawn up a 100 consumers for processing messages from the "queue" (logs).
  How can it be done?</p>