javaspringapache-kafkadependenciesspring-kafka

Cannot resolve method 'setRetryTemplate' in 'ConcurrentKafkaListenerContainerFactory'


I'm working on my Spring project using Spring Kafka module. I'm trying to setup ConcurrentKafkaListenerContainerFactory and I want to set my RetryTemplate, but there is no such method in this class. The problem is, that according to the spring documentation, there should be setRetryTemplate method, because it's inheireted from AbstractKafkaListenerContainerFactory (AbstractKafkaListenerContainerFactory docs, ConcurrentKafkaListenerContainerFactory docs). I tried to look through sources from my IDE (Intellij Idea) and, to my surprise, didn't find this method in AbstractKafkaListenerContainerFactory class. What should I do? I have no idea what's wrong. Was this method removed? My Spring Boot version is 3.3.2. I've tried to remove spring-kafka from my pom.xml, load maven changes, add spring-kafka back and load maven changes but it's didn't help me.


Solution

  • That Javadoc is too old and for version (2.6.3) which are out of support for years. This one is the latest: https://docs.spring.io/spring-kafka/docs/current/api/.

    The RetryTemplate functionality has need replaced by the DefaultErrorHandler its BackOff settings: https://docs.spring.io/spring-kafka/reference/kafka/annotation-error-handling.html#default-eh