kamal
kamal

Reputation: 55

KafkaListener annotation at class level with errorhandler property ignored

When using the kafkalistener annotation at class level and the provided errorhandler property is ignored. When method is annotated with kafkalistner and the provided errorhandler is working. Is it expected behavior?

Upvotes: 2

Views: 484

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121177

This is really bug. The piece of code:

    String errorHandlerBeanName = resolveExpressionAsString(kafkaListener.errorHandler(), "errorHandler");
    if (StringUtils.hasText(errorHandlerBeanName)) {
        endpoint.setErrorHandler(this.beanFactory.getBean(errorHandlerBeanName, KafkaListenerErrorHandler.class));
    }

Is missed in the:

private void processMultiMethodListeners(Collection<KafkaListener> classLevelListeners, List<Method> multiMethods,
        Object bean, String beanName) {

Unfortunately I don't see a simple way to workaround this. Please, consider to have a single @KafkaListener method with an Object as payload and manual type routing in that method to others.

Feel free to raise a GitHub issue on the matter!

Upvotes: 1

Related Questions