Interface KafkaListenerErrorHandler
- All Known Subinterfaces:
ConsumerAwareListenerErrorHandler,ManualAckListenerErrorHandler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An error handler which is called when a
@KafkaListener method
throws an exception. This is invoked higher up the stack than the
listener container's error handler. For methods annotated with
@SendTo, the error handler can return a result.- Since:
- 1.3
-
Method Summary
Modifier and TypeMethodDescriptionhandleError(org.springframework.messaging.Message<?> message, ListenerExecutionFailedException exception) Handle the error.default ObjecthandleError(org.springframework.messaging.Message<?> message, ListenerExecutionFailedException exception, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer) Handle the error.default ObjecthandleError(org.springframework.messaging.Message<?> message, ListenerExecutionFailedException exception, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, Acknowledgment ack) Handle the error.
-
Method Details
-
handleError
Object handleError(org.springframework.messaging.Message<?> message, ListenerExecutionFailedException exception) Handle the error.- Parameters:
message- the spring-messaging message.exception- the exception the listener threw, wrapped in aListenerExecutionFailedException.- Returns:
- the return value is ignored unless the annotated method has a
@SendToannotation.
-
handleError
default Object handleError(org.springframework.messaging.Message<?> message, ListenerExecutionFailedException exception, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer) Handle the error.- Parameters:
message- the spring-messaging message.exception- the exception the listener threw, wrapped in aListenerExecutionFailedException.consumer- the consumer.- Returns:
- the return value is ignored unless the annotated method has a
@SendToannotation.
-
handleError
default Object handleError(org.springframework.messaging.Message<?> message, ListenerExecutionFailedException exception, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, @Nullable Acknowledgment ack) Handle the error.- Parameters:
message- the spring-messaging message.exception- the exception the listener threw, wrapped in aListenerExecutionFailedException.consumer- the consumer.ack- theAcknowledgment.- Returns:
- the return value is ignored unless the annotated method has a
@SendToannotation.
-