title: how to set kafka consumer concurrency using spring boot
body: <p>I am writing a Java based Kafka Consumer application. I am utilizing kafka-clients, Spring Kafka and Spring boot for my application. While Spring boot lets me easily write Kafka Consumers (without really writing the ConcurrentKafkaListenerContainerFactory, ConsumerFactory etc), I want to be able to define / customize some of the properties for these consumers. However, I could not find out an easy way to do it using Spring boot. For eg: some of the properties that I would be interested in setting up are - </p>
  
  <p><code>ConsumerConfig.MAX_PARTITION_FETCH_BYTES_CONFIG</code>
  <code>ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG</code></p>
  
  <p>I took a look at the Spring Boot pre-defined properties <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html" rel="nofollow noreferrer">here</a>.</p>
  
  <p>Also, based on an earlier question <a href="https://stackoverflow.com/questions/50051768/how-to-write-kafka-consumers-single-threaded-vs-multi-threaded">here</a>, I want to setup the concurrency on the consumers, but cannot find a configuration, application.properties driven way to do that using Spring Boot.</p>
  
  <p>An obvious way is to define the <code>ConcurrentKafkaListenerContainerFactory, ConsumerFactory</code> classes again in my Spring Context and work from there. I wanted to understand if there is a cleaner way of doing that, especially since I am using Spring Boot.</p>
  
  <p>Versions- </p>
  
  <ul>
  <li>kafka-clients - 0.10.0.0-SASL</li>
  <li>spring-kafka - 1.1.0.RELEASE</li>
  <li>spring boot - 1.5.10.RELEASE</li>
  </ul>