SpringSpring Kafka Configuration
What happens if a @KafkaListener throws an uncaught exception?
Reference answer
Without an error handler: the container uses the default error handler which logs the error, seeks back to the failed offset, and retries indefinitely (blocking that partition). With DefaultErrorHandler: retry up to maxAttempts times with BackOff, then call the recoverer (e.g., DLT publish) or rethrow. If the exception is non-retryable (classified via addNotRetryableExceptions), it's sent directly to DLT without retries. The key risk without proper error handling: an infinite retry loop that blocks partition processing and causes consumer lag for all partitions assigned to that consumer thread.
Expected key concepts: uncaught exception, error handler, seeks back, offset, retry, DefaultErrorHandler, maxAttempts, DLT, non-retryable, addNotRetryableExceptions, infinite retry loop, consumer lag