Class ListenerContainerPauseService
- java.lang.Object
-
- org.springframework.kafka.listener.ListenerContainerPauseService
-
public class ListenerContainerPauseService extends java.lang.ObjectService for pausing and resuming ofMessageListenerContainer.- Since:
- 2.9
- Author:
- Jan Marincek, Gary Russell
-
-
Constructor Summary
Constructors Constructor Description ListenerContainerPauseService(ListenerContainerRegistry registry, org.springframework.scheduling.TaskScheduler scheduler)Create an instance with the provided registry and scheduler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidpause(java.lang.String listenerId, java.time.Duration pauseDuration)Pause the listener by given id.voidpause(MessageListenerContainer messageListenerContainer, java.time.Duration pauseDuration)Pause the listener by given container instance.voidpausePartition(MessageListenerContainer messageListenerContainer, org.apache.kafka.common.TopicPartition partition, java.time.Duration pauseDuration)Pause consumption from a given partition for the duration.voidresume(java.lang.String listenerId)Resume the listener container by given id.voidresume(MessageListenerContainer messageListenerContainer)Resume the listener container.
-
-
-
Constructor Detail
-
ListenerContainerPauseService
public ListenerContainerPauseService(@Nullable ListenerContainerRegistry registry, org.springframework.scheduling.TaskScheduler scheduler)Create an instance with the provided registry and scheduler.- Parameters:
registry- the registry or null.scheduler- the scheduler.
-
-
Method Detail
-
pause
public void pause(java.lang.String listenerId, java.time.Duration pauseDuration)Pause the listener by given id. Checks if the listener has already been requested to pause. Sets executor schedule for resuming the same listener after pauseDuration.- Parameters:
listenerId- the id of the listenerpauseDuration- duration between pause() and resume() actions
-
pause
public void pause(MessageListenerContainer messageListenerContainer, java.time.Duration pauseDuration)
Pause the listener by given container instance. Checks if the listener has already been requested to pause. Sets executor schedule for resuming the same listener after pauseDuration.- Parameters:
messageListenerContainer- the listener containerpauseDuration- duration between pause() and resume() actions
-
pausePartition
public void pausePartition(MessageListenerContainer messageListenerContainer, org.apache.kafka.common.TopicPartition partition, java.time.Duration pauseDuration)
Pause consumption from a given partition for the duration.- Parameters:
messageListenerContainer- the container.partition- the partition.pauseDuration- the duration.
-
resume
public void resume(java.lang.String listenerId)
Resume the listener container by given id.- Parameters:
listenerId- the id of the listener
-
resume
public void resume(MessageListenerContainer messageListenerContainer)
Resume the listener container.- Parameters:
messageListenerContainer- the listener container
-
-