public final class SeekUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static org.springframework.util.backoff.FixedBackOff |
DEFAULT_BACK_OFF
The default back off - a
FixedBackOff with 0 interval and
DEFAULT_MAX_FAILURES - 1 retry attempts. |
static int |
DEFAULT_MAX_FAILURES
The number of times a topic/partition/offset can fail before being rejected.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
doSeeks(java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> records,
org.apache.kafka.clients.consumer.Consumer<?,?> consumer,
java.lang.Exception exception,
boolean recoverable,
java.util.function.BiPredicate<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> skipper,
org.springframework.core.log.LogAccessor logger)
Seek records to earliest position, optionally skipping the first.
|
static void |
seekOrRecover(java.lang.Exception thrownException,
java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> records,
org.apache.kafka.clients.consumer.Consumer<?,?> consumer,
MessageListenerContainer container,
boolean commitRecovered,
java.util.function.BiPredicate<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> skipPredicate,
org.springframework.core.log.LogAccessor logger,
KafkaException.Level level)
Seek the remaining records, optionally recovering the first.
|
static void |
seekPartitions(org.apache.kafka.clients.consumer.Consumer<?,?> consumer,
java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long> partitions,
org.springframework.core.log.LogAccessor logger)
Perform seek operations on each partition.
|
public static final int DEFAULT_MAX_FAILURES
public static final org.springframework.util.backoff.FixedBackOff DEFAULT_BACK_OFF
FixedBackOff with 0 interval and
DEFAULT_MAX_FAILURES - 1 retry attempts.public static boolean doSeeks(java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> records,
org.apache.kafka.clients.consumer.Consumer<?,?> consumer,
java.lang.Exception exception,
boolean recoverable,
java.util.function.BiPredicate<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> skipper,
org.springframework.core.log.LogAccessor logger)
records - the records.consumer - the consumer.exception - the exceptionrecoverable - true if skipping the first record is allowed.skipper - function to determine whether or not to skip seeking the first.logger - a LogAccessor for seek errors.public static void seekPartitions(org.apache.kafka.clients.consumer.Consumer<?,?> consumer,
java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long> partitions,
org.springframework.core.log.LogAccessor logger)
consumer - the consumer.partitions - the partitions.logger - the logger.public static void seekOrRecover(java.lang.Exception thrownException,
java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> records,
org.apache.kafka.clients.consumer.Consumer<?,?> consumer,
MessageListenerContainer container,
boolean commitRecovered,
java.util.function.BiPredicate<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> skipPredicate,
org.springframework.core.log.LogAccessor logger,
KafkaException.Level level)
thrownException - the exception.records - the remaining records.consumer - the consumer.container - the container.commitRecovered - true to commit the recovererd record offset.skipPredicate - the skip predicate.logger - the logger.level - the log level for the thrown exception after handling.