In Spring boot 3.1.2, this method is deprecated. This is the KafkaConfig class:
public ConcurrentKafkaListenerContainerFactory<String, String> kafkaListenerContainerFactory() {
ConcurrentKafkaListenerContainerFactory<String, String> factory = new
ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(consumerFactory());
// deprecated
factory.setErrorHandler((exception, data) -> {
log.error("exception occurred while processing data {} and the data is {}",
exception, data);
});
return factory;
}
What is the replacement sample for this? The doc says, I should use setCommonErrorHandler, but how to implement the CommonErrorHandler interface, as no method to be overriden is there?
This is not blocking, just an annoying deprecated message though. Thanks
It is mentioned in the Javadocs of that deprecated method:
Also see docs for more info: https://docs.spring.io/spring-kafka/reference/kafka/annotation-error-handling.html