Class ErrorHandlingUtils
java.lang.Object
org.springframework.kafka.listener.ErrorHandlingUtils
Utilities for error handling.
- Since:
- 2.8
- Author:
- Gary Russell
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
recordsToString
(org.apache.kafka.clients.consumer.ConsumerRecords<?, ?> records) Represent the records as a comma-delimited String oftopic-part@offset
.static void
retryBatch
(Exception thrownException, org.apache.kafka.clients.consumer.ConsumerRecords<?, ?> records, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, MessageListenerContainer container, Runnable invokeListener, BackOff backOff, CommonErrorHandler seeker, BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecords<?, ?>, Exception> recoverer, LogAccessor logger, KafkaException.Level logLevel) Retry a complete batch by pausing the consumer and then, in a loop, poll the consumer, wait for the next back off, then call the listener.
-
Method Details
-
retryBatch
public static void retryBatch(Exception thrownException, org.apache.kafka.clients.consumer.ConsumerRecords<?, ?> records, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, MessageListenerContainer container, Runnable invokeListener, BackOff backOff, CommonErrorHandler seeker, BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecords<?, ?>, Exception> recoverer, LogAccessor logger, KafkaException.Level logLevel) Retry a complete batch by pausing the consumer and then, in a loop, poll the consumer, wait for the next back off, then call the listener. When retries are exhausted, call the recoverer with theConsumerRecords
.- Parameters:
thrownException
- the exception.records
- the records.consumer
- the consumer.container
- the container.invokeListener
- theRunnable
to run (call the listener).backOff
- the backOff.seeker
- the common error handler that re-seeks the entire batch.recoverer
- the recoverer.logger
- the logger.logLevel
- the log level.
-
recordsToString
public static String recordsToString(org.apache.kafka.clients.consumer.ConsumerRecords<?, ?> records) Represent the records as a comma-delimited String oftopic-part@offset
.- Parameters:
records
- the records.- Returns:
- the String.
-