Class ContainerPartitionPausingBackOffManager
java.lang.Object
org.springframework.kafka.listener.ContainerPartitionPausingBackOffManager
- All Implemented Interfaces:
KafkaConsumerBackoffManager
public class ContainerPartitionPausingBackOffManager
extends Object
implements KafkaConsumerBackoffManager
A manager that backs off consumption for a given topic if the timestamp provided is not
due. Use with
DefaultErrorHandler
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
- Author:
- Tomaz Fernandes, Gary Russell
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.kafka.listener.KafkaConsumerBackoffManager
KafkaConsumerBackoffManager.Context
-
Constructor Summary
ConstructorsConstructorDescriptionContainerPartitionPausingBackOffManager
(ListenerContainerRegistry listenerContainerRegistry, BackOffHandler backOffHandler) Construct an instance with the provided registry and back off handler. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 Details
-
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 Details
-
backOffIfNecessary
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.
-