title: How to get consumer-id using a @KafkaListener spring boot 2 consumer
body: <p><a href="https://i.stack.imgur.com/xM7YH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xM7YH.png" alt="Consumers listed using bin/kafka-consumer-groups.sh utility "></a></p>
  
  <pre><code>bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group my-consumer
  </code></pre>
  
  <p>Is it possible to get <code>consumer-id</code> information like in above command output in a <code>Spring boot @KafkaListener consumer</code> ?<br>
  I want to add this the consumer-id to a table to represent a processor that processed data.<br>
  I have gone through @gary-russell's answer on <a href="https://stackoverflow.com/questions/52105744/how-to-get-kafka-consumer-id-for-logging">How to get kafka consumer-id for logging</a>, But I dont see consumer-id appearing in partitions assigned logs.</p>
  
  <pre><code>[org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO  o.s.k.l.KafkaMessageListenerContainer.info - my-consumer: partitions assigned: [test_topic-7, test_topic-6, test_topic-5, test_topic-4]
  [org.springframework.kafka.KafkaListenerEndpointContainer#1-0-C-1] INFO  o.s.k.l.KafkaMessageListenerContainer.info - my-consumer: partitions assigned: [test_topic-3, test_topic-2, test_topic-1, test_topic-0]
  </code></pre>
  
  <p>I am using spring boot 2.2.2<br>
  dependencies: spring-kafka</p>