I'm using Spring Boot 3.0.5 with Spring Kafka. I want to configure Non-Blocking topics with RetryTopicConfigurationSupport, as it is written here: https://docs.spring.io/spring-kafka/reference/html/#retry-topic-global-settings
My configuration looks as follows:
@EnableKafka
@Configuration
public class RetryTopicsConfig extends RetryTopicConfigurationSupport {
@Override
protected Consumer<DeadLetterPublishingRecovererFactory> configureDeadLetterPublishingContainerFactory() {
return dlprf -> dlprf.setRetainAllRetryHeaderValues(false);
}
}
When application starts, it produces:
Caused by: java.lang.IllegalArgumentException: Either a RetryTopicSchedulerWrapper or TaskScheduler bean is required
Am I doing something wrong?
When I added:
@Bean
public TaskScheduler taskScheduler() {
return new ThreadPoolTaskScheduler();
}
it starts, but I'm not sure if I suppose to do that? According to documentation (https://docs.spring.io/spring-kafka/reference/html/#programmatic-construction) it is designed for Progammatic Construction, but I use annotations.
I think adding the @EnableScheduling
at the class level of the RetryTopicsConfig.class
is much better in this case