6

How to deal with error handling in version 1.1.x?

As I see it was introduced in version 2.0...

diogo
  • 3,769
  • 1
  • 24
  • 30
Anton Arsentyev
  • 371
  • 1
  • 7
  • 14

1 Answers1

7

In 1.x you can add an ErrorHandler implementation to the listener container (or container factory if you are using @KafkaListener annotations).

The 2.0 feature was added to make it easier to configure if you want a different error handler for each listener when using annotations.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • thanks! will try to implement this, do you have such docs on github ? – Anton Arsentyev May 11 '17 at 14:17
  • It's mentioned (briefly) [here](http://docs.spring.io/spring-kafka/reference/htmlsingle/#_retrying_deliveries) and in [the javadocs](http://docs.spring.io/spring-kafka/api/org/springframework/kafka/listener/config/ContainerProperties.html#setErrorHandler-org.springframework.kafka.listener.ErrorHandler-). – Gary Russell May 11 '17 at 15:47
  • @GaryRussell both the links have expired – Rahul Gupta Mar 29 '19 at 07:11
  • Thanks; new links are [here](https://docs.spring.io/spring-kafka/reference/html/#retrying-deliveries) and [here](https://docs.spring.io/spring-kafka/api/org/springframework/kafka/listener/AbstractMessageListenerContainer.html#setErrorHandler-org.springframework.kafka.listener.ErrorHandler-). – Gary Russell Mar 29 '19 at 13:03
  • How do I get Consumer reference (nor ConsumerData) in my error handler? I am using Spring-kafka 1.3.2RELEASE. I need to commit offset manually for those which encountered error. I understand if I have Consumer refernce in ErrorHandler, then I can commit it. So I am looking for ways to have Consumer Reference in my ErrorHandler. Is it possible without changing Spring-Kafka version? – Prosenjit Jul 19 '20 at 07:45
  • No; it's not possible with 1.x; 1.3.x will not be supported at all after this year so you should plan on upgrading anyway; the current version is 2.5.3. And, don't ask new questions in comments on old answers. – Gary Russell Jul 19 '20 at 14:15