0
votes

I am using MANUAL_IMMEDIATE ack mode, Spring-kafka 1.3.9 (Can't change to Java 8), and committing offsets when processing is complete in Listener code. I am using Custom deserializer and its working fine unless I encounter Deserialization exception. Then onwards kafka gets stuck. I have handled this in by Deserializer, like instead of throwing the exception(When deserialization exception happens) I get a new instance of deserialized object and set the original message (which caused the deserialization exception) in a field(exceptionData) and let it pass to the Listener code(annotated with @KafkaListener). In the Listener code I check if the field exceptionData is NULL or not and accordingly decide 'Good Message' or 'Bad Message' , Because I need to handle 'Bad Messages' too.

Now I want to know is there any way to handle all these from container level. Where I stuck is I don't get the Consumer reference in this version of Spring-kafka 1.3.9. I need to commit offset on error, any error.

1

1 Answers

2
votes

No; it is not possible to get the consumer with that version. The ConsumerAwareErrorHandler was added in 2.0.