title: Cannot disable manual commits on Kafka message using Spring-integration-kafka in Spring-Boot App
body: <p>As I am new to kafka, my group is using Spring-Integration-kafka:2.0.0.RELEASE on a Spring-boot application. I was able to consume kafka message with my KafkaConsumer based on this example <a href="http://howtoprogram.xyz/2016/09/23/spring-kafka-tutorial/" rel="nofollow noreferrer">here</a>.</p>
  
  <p>For this spring-boot application, I have my Application.java</p>
  
  <pre><code>package hello;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import java.util.concurrent.TimeUnit;
  import hello.notification.Listener;
  
  @SpringBootApplication
  public class Application {
  
      private Listener listener;
  
      public void run(String... args) throws Exception {
          this.listener.countDownLatch1.await(60, TimeUnit.SECONDS);
      }
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  }
  </code></pre>
  
  <p>This is my KafkaConsumerConfig.java</p>
  
  <pre><code>package hello.notification;
  
  import ....; //different imports
  
  @Configuration
  @EnableKafka
  public class KafkaConsumerConfig {
      @Bean
      KafkaListenerContainerFactory&lt;ConcurrentMessageListenerContainer&lt;String, String&gt;&gt; kafkaListenerContainerFactory() {
          ConcurrentKafkaListenerContainerFactory&lt;String, String&gt; factory = new ConcurrentKafkaListenerContainerFactory&lt;&gt;();
          factory.setConsumerFactory(consumerFactory());
          factory.setConcurrency(1);
          factory.getContainerProperties().setPollTimeout(3000);
          return factory;
      }
  
      @Bean
      public ConsumerFactory&lt;String, String&gt; consumerFactory() {
          Map&lt;String, Object&gt; propsMap = new HashMap&lt;&gt;();
          propsMap.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
          propsMap.put(ConsumerConfig.GROUP_ID_CONFIG, "group1");
          propsMap.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, false);
          //propsMap.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, 100);
          propsMap.put(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, 6000);
          propsMap.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
          propsMap.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
          return new DefaultKafkaConsumerFactory&lt;&gt;(propsMap);
      }
  
      @Bean
      public Listener listener() {
          return new Listener();
      }
  }
  </code></pre>
  
  <p>and finally my Listener.java</p>
  
  <pre><code>package hello.notification;
  
  import ...; // different imports
  
  public class Listener {
  
      public final CountDownLatch countDownLatch1 = new CountDownLatch(1);
  
      @KafkaListener(topics = "topic1")
      public void listen(ConsumerRecord&lt;?, ?&gt; record, Acknowledgment ack) {
          System.out.println(record + " and " + ack);
                  // Place holder for "ack.acknowledge();"
          countDownLatch1.countDown();
      } 
  }
  </code></pre>
  
  <p>my questions are: </p>
  
  <p>1) In ConsumerConfig settings, I've already set "ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG" to <strong>false</strong> and commented out "ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG", why does it still commits automatically?(as I no longer would see the message if I restart my spring-boot app- I would expect it to try to resend until it's been committed)</p>
  
  <p>2) In order to commit manually, I think I just need to add ack.acknowledge() inside my Listener.listen(please see place-holder)? Is there anything else that I would need other than this to ensure this is a manual commit?</p>
  
  <p>3) I would like to have the simplest/cleanest kafkaconsumer, I wonder if you think what I have is the simplest way, originally I was looking for singlethreaded consumer but there are not a lot of examples out there so I stick with the concurrent listener.</p>
  
  <p>Thanks for all of your help and inputs!</p>