title: Adding ConsumerRebalanceListener to the ConcurrentKafkaListenerContainerFactory
body: <p>In a Spring Boot application I'm using a class annotated with @KafkaListener as a message listener. I want to add a ConsumerRebalanceLister to my application to manage cached data on a rebalance.</p>
  
  <p>How do I add a ConsumerRebalanceListener to a ConcurrentKafkaListenerContainerFactory. The <a href="https://docs.spring.io/spring-kafka/reference/htmlsingle/#rebalance-listeners" rel="nofollow noreferrer">documentation</a> says that it should be set on a ContainerProperties object. It's not clear how to access that object in order to set it. Additionally, it looks like the <a href="https://github.com/spring-projects/spring-kafka/blob/v2.1.10.RELEASE/spring-kafka/src/main/java/org/springframework/kafka/config/ConcurrentKafkaListenerContainerFactory.java" rel="nofollow noreferrer">ConcurrentKafkaListenerContainerFactory</a> throws away the rebalance listener since it creates a new ContainerProperties object when creating a listener container instance.</p>
  
  <p>I feel like I'm missing something really obvious here, before <a href="https://github.com/neilg/spring-kafka/commit/31541fe58e8b1265728301106027b250657aaeb2" rel="nofollow noreferrer">this commit</a> there was a method to simply set the rebalance listener directly on the ConcurrentKafkaListenerContainerFactory.</p>