Class AbstractPulsarMessageListenerContainer<T>
java.lang.Object
org.springframework.pulsar.listener.AbstractPulsarMessageListenerContainer<T>
- Type Parameters:
T- message type.
- All Implemented Interfaces:
Aware,BeanNameAware,DisposableBean,ApplicationContextAware,ApplicationEventPublisherAware,Lifecycle,Phased,SmartLifecycle,MessageListenerContainer,PulsarMessageListenerContainer
- Direct Known Subclasses:
ConcurrentPulsarMessageListenerContainer,DefaultPulsarMessageListenerContainer
public abstract non-sealed class AbstractPulsarMessageListenerContainer<T>
extends Object
implements PulsarMessageListenerContainer, BeanNameAware, ApplicationEventPublisherAware, ApplicationContextAware
Base implementation for the
PulsarMessageListenerContainer.- Author:
- Soby Chacko, Alexander Preuß
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.pulsar.client.api.RedeliveryBackoffprotected org.apache.pulsar.client.api.DeadLetterPolicyprotected final Objectprotected final LogAccessorprotected org.apache.pulsar.client.api.RedeliveryBackoffprotected PulsarConsumerErrorHandler<T>Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractPulsarMessageListenerContainer(PulsarConsumerFactory<? super T> pulsarConsumerFactory, PulsarContainerProperties pulsarContainerProperties, io.micrometer.observation.ObservationRegistry observationRegistry) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voiddoStart()protected abstract voiddoStop()org.apache.pulsar.client.api.RedeliveryBackoffprotected ApplicationContextGet the event publisher.Return the bean name.org.apache.pulsar.client.api.DeadLetterPolicyorg.apache.pulsar.client.api.RedeliveryBackoffio.micrometer.observation.ObservationRegistryintgetPhase()booleanbooleanvoidsetAckTimeoutRedeliveryBackoff(org.apache.pulsar.client.api.RedeliveryBackoff redeliveryBackoff) voidsetApplicationContext(ApplicationContext applicationContext) voidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) voidsetAutoStartup(boolean autoStartup) voidsetBeanName(String name) voidsetDeadLetterPolicy(org.apache.pulsar.client.api.DeadLetterPolicy deadLetterPolicy) voidsetNegativeAckRedeliveryBackoff(org.apache.pulsar.client.api.RedeliveryBackoff redeliveryBackoff) voidsetPhase(int phase) voidsetPulsarConsumerErrorHandler(PulsarConsumerErrorHandler pulsarConsumerErrorHandler) protected voidsetRunning(boolean running) voidsetupMessageListener(Object messageListener) final voidstart()voidstop()Methods 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
stop
-
Field Details
-
logger
-
lifecycleMonitor
-
negativeAckRedeliveryBackoff
protected org.apache.pulsar.client.api.RedeliveryBackoff negativeAckRedeliveryBackoff -
ackTimeoutRedeliveryBackoff
protected org.apache.pulsar.client.api.RedeliveryBackoff ackTimeoutRedeliveryBackoff -
deadLetterPolicy
protected org.apache.pulsar.client.api.DeadLetterPolicy deadLetterPolicy -
pulsarConsumerErrorHandler
-
-
Constructor Details
-
AbstractPulsarMessageListenerContainer
protected AbstractPulsarMessageListenerContainer(PulsarConsumerFactory<? super T> pulsarConsumerFactory, PulsarContainerProperties pulsarContainerProperties, @Nullable io.micrometer.observation.ObservationRegistry observationRegistry)
-
-
Method Details
-
getPulsarConsumerFactory
-
getContainerProperties
- Specified by:
getContainerPropertiesin interfacePulsarMessageListenerContainer
-
getObservationRegistry
public io.micrometer.observation.ObservationRegistry getObservationRegistry() -
setApplicationEventPublisher
- Specified by:
setApplicationEventPublisherin interfaceApplicationEventPublisherAware
-
isRunning
public boolean isRunning() -
setRunning
protected void setRunning(boolean running) -
getApplicationEventPublisher
Get the event publisher.- Returns:
- the publisher
-
setBeanName
- Specified by:
setBeanNamein interfaceBeanNameAware
-
getBeanName
Return the bean name.- Returns:
- the bean name.
-
setApplicationContext
- Specified by:
setApplicationContextin interfaceApplicationContextAware- Throws:
BeansException
-
getApplicationContext
-
setupMessageListener
- Specified by:
setupMessageListenerin interfacePulsarMessageListenerContainer
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartupin interfaceSmartLifecycle
-
setAutoStartup
public void setAutoStartup(boolean autoStartup) - Specified by:
setAutoStartupin interfaceMessageListenerContainer
-
setPhase
public void setPhase(int phase) -
getPhase
public int getPhase()- Specified by:
getPhasein interfacePhased- Specified by:
getPhasein interfaceSmartLifecycle
-
doStart
protected abstract void doStart() -
doStop
protected abstract void doStop() -
start
public final void start() -
stop
public void stop() -
setNegativeAckRedeliveryBackoff
public void setNegativeAckRedeliveryBackoff(org.apache.pulsar.client.api.RedeliveryBackoff redeliveryBackoff) - Specified by:
setNegativeAckRedeliveryBackoffin interfacePulsarMessageListenerContainer
-
setAckTimeoutRedeliveryBackoff
public void setAckTimeoutRedeliveryBackoff(org.apache.pulsar.client.api.RedeliveryBackoff redeliveryBackoff) - Specified by:
setAckTimeoutRedeliveryBackoffin interfacePulsarMessageListenerContainer
-
getNegativeAckRedeliveryBackoff
public org.apache.pulsar.client.api.RedeliveryBackoff getNegativeAckRedeliveryBackoff() -
getAckTimeoutkRedeliveryBackoff
public org.apache.pulsar.client.api.RedeliveryBackoff getAckTimeoutkRedeliveryBackoff() -
setDeadLetterPolicy
public void setDeadLetterPolicy(org.apache.pulsar.client.api.DeadLetterPolicy deadLetterPolicy) - Specified by:
setDeadLetterPolicyin interfacePulsarMessageListenerContainer
-
getDeadLetterPolicy
public org.apache.pulsar.client.api.DeadLetterPolicy getDeadLetterPolicy() -
getPulsarConsumerErrorHandler
-
setPulsarConsumerErrorHandler
- Specified by:
setPulsarConsumerErrorHandlerin interfacePulsarMessageListenerContainer
-