title: Reading the same message several times from Kafka
body: <p>I use <a href="http://docs.spring.io/spring-kafka/reference/htmlsingle/#_retrying_deliverieshttp://" rel="noreferrer">Spring Kafka API</a> to implement Kafka consumer with manual offset management:</p>
  
  <pre><code>@KafkaListener(topics = "some_topic")
  public void onMessage(@Payload Message message, Acknowledgment acknowledgment) {
      if (someCondition) {
          acknowledgment.acknowledge();
      }
  }
  </code></pre>
  
  <p>Here, I want the consumer to commit the offset only if <code>someCondition</code> holds. Otherwise the consumer should sleep for some time and read <em>the same message</em> again.</p>
  
  <p>Kafka Configuration:</p>
  
  <pre><code>@Bean
  public ConcurrentKafkaListenerContainerFactory&lt;String, String&gt; kafkaListenerContainerFactory() {
      ConcurrentKafkaListenerContainerFactory&lt;String, String&gt; factory = new ConcurrentKafkaListenerContainerFactory&lt;&gt;();
      factory.setConsumerFactory(new DefaultKafkaConsumerFactory&lt;&gt;(consumerConfig());
      factory.getContainerProperties().setAckMode(MANUAL);
      return factory;
  }
  
  private Map&lt;String, Object&gt; consumerConfig() {
      Map&lt;String, Object&gt; props = new HashMap&lt;&gt;();
      ...
      props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "false");
      ...
      return props;
  }
  </code></pre>
  
  <p>With the current configuration, if <code>someCondition == false</code>, consumer doesn't commit the offset, but still reads the next messages. Is there a way to make the consumer reread a message if the Kafka <code>acknowledgement</code> wasn't performed? </p>