title: Kafka is giving: "The group member needs to have a valid member id before actually entering a consumer group"
body: <p>I am using Kafka to consume messages in Java.  I want to test by starting the same app multiple times on my local box. When I start up, the first time I am able to start consuming messages from the topic.  When I start up a second one I get:</p>
  <pre><code>Join group failed with org.apache.kafka.common.errors.MemberIdRequiredException: The group member needs to have a valid member id before actually entering a consumer group
  </code></pre>
  <p>and dont get any messages from the topic.  If I try to start more of them I get the same issues.</p>
  <p>The configuration I am using for Kafka is</p>
  <pre class="lang-yaml prettyprint-override"><code>spring:
    kafka:
      bootstrap-servers: kafka:9092
      consumer:
        auto-offset-reset: earliest
        key-deserializer: org.springframework.kafka.support.serializer.ErrorHandlingDeserializer2
        value-deserializer: org.springframework.kafka.support.serializer.ErrorHandlingDeserializer2
        properties:
          spring.deserializer.key.delegate.class: org.springframework.kafka.support.serializer.JsonDeserializer
          spring.deserializer.value.delegate.class: org.springframework.kafka.support.serializer.JsonDeserializer
          spring.json.use.type.headers: false
      listener:
        missing-topics-fatal: false
  </code></pre>
  <p>I have two topics</p>
  <pre class="lang-java prettyprint-override"><code>@Configuration
  public class KafkaTopics {
      @Bean(&quot;alertsTopic&quot;)
      public NewTopic alertsTopic() {
  
          return TopicBuilder.name(&quot;XXX.alerts&quot;)
              .compact()
              .build();
      }
  
      @Bean(&quot;serversTopic&quot;)
      public NewTopic serversTopic() {
  
          return TopicBuilder.name(&quot;XXX.servers&quot;)
              .compact()
              .build();
      }
  
  }
  </code></pre>
  <p>And two listeners in <em>different</em> class files.</p>
  <pre><code>@KafkaListener(topics = SERVERS_KAFKA_TOPIC, id = &quot;#{T(java.util.UUID).randomUUID().toString()}&quot;,
      properties = {
          &quot;spring.json.key.default.type=java.lang.String&quot;,
          &quot;spring.json.value.default.type=com.devhaus.learningjungle.db.kafka.ServerInfo&quot;
      })
  public void registerServer(
      @Payload(required = false) ServerInfo serverInfo
  ) 
  
  @KafkaListener(topics = ALERTS_KAFKA_TOPIC,
      id = &quot;#{T(java.util.UUID).randomUUID().toString()}&quot;,
      properties = {
          &quot;spring.json.key.default.type=com.devhaus.learningjungle.db.kafka.AlertOnKafkaKey&quot;,
          &quot;spring.json.value.default.type=com.devhaus.learningjungle.db.kafka.AlertOnKafka&quot;
      })
  public void processAlert(
      @Header(KafkaHeaders.RECEIVED_MESSAGE_KEY) AlertOnKafkaKey key,
      @Header(KafkaHeaders.RECEIVED_PARTITION_ID) int partitionId,
      @Header(KafkaHeaders.OFFSET) long offset,
      @Payload(required = false) AlertOnKafka alert)
  </code></pre>
  <pre><code></code></pre>