title: kafka restabilizing group using spring kafka consumer
body: <p>I have a quite slow consumer which could take more than 5 minutes to process the record. What I want to avoid is kafka restabilizing the group.
  In order to do this from my understanding I have to set to the kafka broker the following properties:</p>
  
  <pre><code>  group.max.session.timeout.ms = 3600001 
    group.min.session.timeout.ms = 3600000
  </code></pre>
  
  <p>In my application side I have the following configuration :</p>
  
  <pre><code>    @Bean
        public Map&lt;String, Object&gt; consumerConfigs() {
          final Map&lt;String, Object&gt; propsMap = new HashMap&lt;&gt;();
          propsMap.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
              environment.getProperty("app.kafkaBrokers"));
          propsMap.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true);
          propsMap.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, "100");
          propsMap.put(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, Integer.valueOf(environment.getProperty("app.session.timeout.ms")) );
          propsMap.put(ConsumerConfig.REQUEST_TIMEOUT_MS_CONFIG, Integer.valueOf(environment.getProperty("app.session.timeout.ms")) + 1 );
          propsMap.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
          propsMap.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
          propsMap.put(ConsumerConfig.GROUP_ID_CONFIG, "group1");
          propsMap.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "latest");
          return propsMap;
        }
  
  @Bean
    KafkaListenerContainerFactory&lt;ConcurrentMessageListenerContainer&lt;String, String&gt;&gt; kafkaListenerContainerFactory() {
      final ConcurrentKafkaListenerContainerFactory&lt;String, String&gt; factory =
          new ConcurrentKafkaListenerContainerFactory&lt;&gt;();
      factory.setConsumerFactory(consumerFactory());
      factory.setConcurrency(9);// was 3
      factory.getContainerProperties().setPollTimeout(3000);
      return factory;
    }
  </code></pre>
  
  <p>And also in my listener I have:</p>
  
  <pre><code> @KafkaListener(id = "baz", topics = "tipJobsForExecution", containerFactory="kafkaListenerContainerFactory")
    public void listen(ConsumerRecord&lt;?, ?&gt; record)
  </code></pre>
  
  <p>My listener takes about 5 minutes to process the messages. As soon as it finished I read the following at kafka broker side:</p>
  
  <blockquote>
    <p>2018-05-03 10:29:11,210] INFO [GroupCoordinator 0]: Preparing to
    rebalance group baz with old generation 22 (__consumer_offsets-7)
    (kafka.coordinator.group.GroupCoordinator)</p>
  </blockquote>
  
  <p>From my understanding kafka consideres the consumer dead and rebalances the group. My question is why is this happenning ? 
  One idea that I have is that maybe the heartbeat is not heartbeating every  3000ms as it should but I do not know how troubleshout this.</p>
  
  <p>Thanks in advance,
  Giannis</p>