Class ContainerPartitionPausingBackOffManager
- java.lang.Object
-
- org.springframework.kafka.listener.ContainerPartitionPausingBackOffManager
-
- All Implemented Interfaces:
KafkaConsumerBackoffManager
public class ContainerPartitionPausingBackOffManager extends java.lang.Object implements KafkaConsumerBackoffManager
A manager that backs off consumption for a given topic if the timestamp provided is not due. Use withDefaultErrorHandler
to guarantee that the message is read again after partition consumption is resumed (or seek it manually by other means). Note that when a record backs off the partition consumption gets paused for approximately that amount of time, so you must have a fixed backoff value per partition.- Since:
- 2.9
- See Also:
DefaultErrorHandler
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.springframework.kafka.listener.KafkaConsumerBackoffManager
KafkaConsumerBackoffManager.Context
-
-
Constructor Summary
Constructors Constructor Description ContainerPartitionPausingBackOffManager(ListenerContainerRegistry listenerContainerRegistry, BackOffHandler backOffHandler)
Construct an instance with the provided registry and back off handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
backOffIfNecessary(KafkaConsumerBackoffManager.Context context)
Backs off if the current time is before the dueTimestamp provided in theKafkaConsumerBackoffManager.Context
object.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.springframework.kafka.listener.KafkaConsumerBackoffManager
createContext
-
-
-
-
Constructor Detail
-
ContainerPartitionPausingBackOffManager
public ContainerPartitionPausingBackOffManager(ListenerContainerRegistry listenerContainerRegistry, BackOffHandler backOffHandler)
Construct an instance with the provided registry and back off handler.- Parameters:
listenerContainerRegistry
- the registry.backOffHandler
- the handler.
-
-
Method Detail
-
backOffIfNecessary
public void backOffIfNecessary(KafkaConsumerBackoffManager.Context context)
Backs off if the current time is before the dueTimestamp provided in theKafkaConsumerBackoffManager.Context
object.- Specified by:
backOffIfNecessary
in interfaceKafkaConsumerBackoffManager
- Parameters:
context
- the back off context for this execution.
-
-