title: Spring Cloud Stream Kafka retries 10 times the maxAttempts
body: <p>I've been trying to implement retry logic for Spring cloud stream kafka such that if an exception is throw when producing an event to the topic <code>sample-topic</code>, It retries two more time.<br>
  I added in the following configuration to the application.properties file</p>
  <pre><code>spring.cloud.stream.bindings.processSampleEvent.destination=sample-topic
  spring.cloud.stream.bindings.processSampleEvent.content-type=application/json
  spring.cloud.stream.bindings.processSampleEvent.consumer.maxAttempts=2
  </code></pre>
  <p>I've written the lister code in way that it simply logs the received message and throws a NullPointerException so that I can test out the retry.</p>
  <pre class="lang-java prettyprint-override"><code>@StreamListener(ListenerBind.SAMPLE_CHANNEL)
    public void processSampleEvent(String productEventDto) {
      System.out.println(&quot;Entering listener: &quot; + productEventDto);
      throw new NullPointerException();
  }
  </code></pre>
  <p>But when testing out by producing an event to the <code>sample-topic</code>, I see that in the logs the event has been retries 20 times but I've specified in the properties to try only two time and also a weird thing happens when I change to it 3 times, It retries 30 times.<br>
  I'm pretty new to Spring cloud streams and any help on this would be really helpful.
  Thanks in Advance </p>