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
- Author:
- Venil Noronha, Gary Russell, Artem Bilan
-
Method Summary
Modifier and TypeMethodDescriptionhandleError
(Message<?> message, ListenerExecutionFailedException exception) Handle the error.default Object
handleError
(Message<?> message, ListenerExecutionFailedException exception, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer) Handle the error.default Object
handleError
(Message<?> message, ListenerExecutionFailedException exception, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, Acknowledgment ack) Handle the error.
-
Method Details
-
handleError
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
@SendTo
annotation.
-
handleError
default Object handleError(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
@SendTo
annotation.
-
handleError
default Object handleError(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
@SendTo
annotation.
-