Skip to content
Kafka Is FunProgress

SpringSpring Kafka Error Handling

What is the difference between DefaultErrorHandler and CommonErrorHandler in Spring Kafka?

Reference answer

CommonErrorHandler is the interface (Spring Kafka 2.8+) that replaced the old ErrorHandler hierarchy. DefaultErrorHandler implements CommonErrorHandler. It's configured on the container: factory.setCommonErrorHandler(new DefaultErrorHandler(recoverer, backOff)). Key improvements over old SeekToCurrentErrorHandler: unified batch+record handling, configurable BackOff, integrated recovery (no separate RecoveryCallback), addRetryableExceptions/addNotRetryableExceptions for fine-grained retry classification, and better integration with @RetryableTopic.

Expected key concepts: CommonErrorHandler, DefaultErrorHandler, Spring Kafka 2.8, SeekToCurrentErrorHandler, unified, BackOff, recovery, addRetryableExceptions, addNotRetryableExceptions, retry classification