public final class ListenerUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static ListenerType |
determineListenerType(java.lang.Object listener) |
static DeserializationException |
getExceptionFromHeader(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record,
java.lang.String headerName,
org.springframework.core.log.LogAccessor logger)
Extract a
DeserializationException from the supplied header name, if
present. |
static java.lang.String |
recordToString(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record)
Return the
ConsumerRecord as a String; either toString() or
topic-partition@offset. |
static void |
setLogOnlyMetadata(boolean onlyMeta)
Set to true to only log record metadata.
|
static void |
unrecoverableBackOff(org.springframework.util.backoff.BackOff backOff,
java.lang.ThreadLocal<org.springframework.util.backoff.BackOffExecution> executions,
java.lang.ThreadLocal<java.lang.Long> lastIntervals)
Sleep according to the
BackOff; when the BackOffExecution returns
BackOffExecution.STOP sleep for the previous backOff. |
public static ListenerType determineListenerType(java.lang.Object listener)
@Nullable public static DeserializationException getExceptionFromHeader(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record, java.lang.String headerName, org.springframework.core.log.LogAccessor logger)
DeserializationException from the supplied header name, if
present.record - the consumer record.headerName - the header name.logger - the logger for logging errors.public static void setLogOnlyMetadata(boolean onlyMeta)
onlyMeta - true to only log record metadata.recordToString(ConsumerRecord)public static java.lang.String recordToString(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record)
ConsumerRecord as a String; either toString() or
topic-partition@offset.record - the record.setLogOnlyMetadata(boolean)public static void unrecoverableBackOff(org.springframework.util.backoff.BackOff backOff,
java.lang.ThreadLocal<org.springframework.util.backoff.BackOffExecution> executions,
java.lang.ThreadLocal<java.lang.Long> lastIntervals)
BackOff; when the BackOffExecution returns
BackOffExecution.STOP sleep for the previous backOff.backOff - the BackOff to create a new BackOffExecution.executions - a thread local containing the BackOffExecution for this
thread.lastIntervals - a thread local containing the previous BackOff
interval for this thread.