title: Spring Kafka Retry Logging
body: <p>I have  a requirement to consume from a  kafka topic,do some work on records and produce to another topic with spring-kafka 2.1.7.Other requiremenrs are transactional for once only semantics,retry and error handling.On failure to commit a record  I should do 3 retries ,log each of the retry messaage to retry topic anf on failure of all retries send the record to a dead letter topic . I looked at <a href="https://github.com/spring-projects/spring-kafka/issues/575" rel="nofollow noreferrer">https://github.com/spring-projects/spring-kafka/issues/575</a> and it  has excellent details on solving the  problem. The thing that I am struggling with is how to log each of the retry message with details like consumer offset ,topic it was trying to commit,etc .Is there a way to  get these from retry call back ?. The retrylistener snippet below is registered with a org.springframework.kafka.listener.LoggingErrorHandler that is set as container property to ConcurrentKafkaListenerContainerFactory ?</p>
  
  <pre><code>         @Bean
           public RetryListener retryListener(KafkaTemplate&lt;String,SpecificRecord&gt; kafkaTemplate) {
               return new RetryListenerSupport() {
  
                  public void onError(RetryContext context, RetryCallback callback, Throwable throwable) {
                      int retryCount =context.getRetryCount();
                      kafkaTemplate) .send(new ProducerRecord&lt;String,SpecificRecord&gt;("topic_name",record));
                  }
               };
           }
  </code></pre>