Class ConcurrentPulsarMessageListenerContainer<T>
java.lang.Object
org.springframework.pulsar.core.AbstractPulsarMessageContainer
org.springframework.pulsar.listener.AbstractPulsarMessageListenerContainer<T>
org.springframework.pulsar.listener.ConcurrentPulsarMessageListenerContainer<T>
- Type Parameters:
T- the payload type.
- All Implemented Interfaces:
Aware,BeanNameAware,DisposableBean,ApplicationContextAware,ApplicationEventPublisherAware,Lifecycle,Phased,SmartLifecycle,MessageListenerContainer,PulsarMessageListenerContainer
public class ConcurrentPulsarMessageListenerContainer<T>
extends AbstractPulsarMessageListenerContainer<T>
Creates a concurrent execution context of
DefaultPulsarMessageListenerContainer
instances based on the concurrency. Concurrency > 1 is not
allowed for exclusive subscriptions.- Author:
- Soby Chacko, Alexander Preuß, Chris Bono
-
Field Summary
Fields inherited from class org.springframework.pulsar.listener.AbstractPulsarMessageListenerContainer
ackTimeoutRedeliveryBackoff, consumerBuilderCustomizer, deadLetterPolicy, lifecycleMonitor, negativeAckRedeliveryBackoff, pulsarConsumerErrorHandlerFields inherited from class org.springframework.pulsar.core.AbstractPulsarMessageContainer
autoStartup, logger, runningFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionConcurrentPulsarMessageListenerContainer(PulsarConsumerFactory<? super T> pulsarConsumerFactory, PulsarContainerProperties pulsarContainerProperties, io.micrometer.observation.ObservationRegistry observationRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoiddoPause()voiddoResume()voiddoStart()voiddoStop()intvoidsetConcurrency(int concurrency) The maximum number of concurrentDefaultPulsarMessageListenerContainers running.Methods inherited from class org.springframework.pulsar.listener.AbstractPulsarMessageListenerContainer
getAckTimeoutkRedeliveryBackoff, getConsumerBuilderCustomizer, getContainerProperties, getDeadLetterPolicy, getNegativeAckRedeliveryBackoff, getObservationRegistry, getPulsarConsumerErrorHandler, getPulsarConsumerFactory, isAutoStartup, isPaused, isRunning, pause, resume, setAckTimeoutRedeliveryBackoff, setAutoStartup, setConsumerCustomizer, setDeadLetterPolicy, setNegativeAckRedeliveryBackoff, setPaused, setPulsarConsumerErrorHandler, setRunning, setupMessageListener, start, stopMethods inherited from class org.springframework.pulsar.core.AbstractPulsarMessageContainer
getApplicationContext, getApplicationEventPublisher, getBeanName, getPhase, setApplicationContext, setApplicationEventPublisher, setBeanName, setPhaseMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.pulsar.listener.MessageListenerContainer
destroyMethods inherited from interface org.springframework.context.SmartLifecycle
getPhase, stop
-
Constructor Details
-
ConcurrentPulsarMessageListenerContainer
public ConcurrentPulsarMessageListenerContainer(PulsarConsumerFactory<? super T> pulsarConsumerFactory, PulsarContainerProperties pulsarContainerProperties, @Nullable io.micrometer.observation.ObservationRegistry observationRegistry)
-
-
Method Details
-
getConcurrency
public int getConcurrency() -
setConcurrency
public void setConcurrency(int concurrency) The maximum number of concurrentDefaultPulsarMessageListenerContainers running. Messages from within the same partition will be processed sequentially. Concurrency > 1 is not allowed for exclusive subscriptions.- Parameters:
concurrency- the concurrency.
-
doStart
public void doStart()- Specified by:
doStartin classAbstractPulsarMessageContainer
-
doStop
public void doStop()- Specified by:
doStopin classAbstractPulsarMessageContainer
-
getContainers
-
doPause
public void doPause()- Specified by:
doPausein classAbstractPulsarMessageListenerContainer<T>
-
doResume
public void doResume()- Specified by:
doResumein classAbstractPulsarMessageListenerContainer<T>
-