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
Modifier and TypeFieldDescriptionprotected org.apache.pulsar.client.api.RedeliveryBackoff
protected org.apache.pulsar.client.api.DeadLetterPolicy
protected final Object
protected final LogAccessor
protected org.apache.pulsar.client.api.RedeliveryBackoff
protected PulsarConsumerErrorHandler<T>
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractPulsarMessageListenerContainer
(PulsarConsumerFactory<? super T> pulsarConsumerFactory, PulsarContainerProperties pulsarContainerProperties, io.micrometer.observation.ObservationRegistry observationRegistry) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
doStart()
protected abstract void
doStop()
org.apache.pulsar.client.api.RedeliveryBackoff
protected ApplicationContext
Get the event publisher.Return the bean name.org.apache.pulsar.client.api.DeadLetterPolicy
org.apache.pulsar.client.api.RedeliveryBackoff
io.micrometer.observation.ObservationRegistry
int
getPhase()
boolean
boolean
void
setAckTimeoutRedeliveryBackoff
(org.apache.pulsar.client.api.RedeliveryBackoff redeliveryBackoff) void
setApplicationContext
(ApplicationContext applicationContext) void
setApplicationEventPublisher
(ApplicationEventPublisher applicationEventPublisher) void
setAutoStartup
(boolean autoStartup) void
setBeanName
(String name) void
setDeadLetterPolicy
(org.apache.pulsar.client.api.DeadLetterPolicy deadLetterPolicy) void
setNegativeAckRedeliveryBackoff
(org.apache.pulsar.client.api.RedeliveryBackoff redeliveryBackoff) void
setPhase
(int phase) void
setPulsarConsumerErrorHandler
(PulsarConsumerErrorHandler pulsarConsumerErrorHandler) protected void
setRunning
(boolean running) void
setupMessageListener
(Object messageListener) final void
start()
void
stop()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.pulsar.listener.MessageListenerContainer
destroy
Methods 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:
getContainerProperties
in interfacePulsarMessageListenerContainer
-
getObservationRegistry
public io.micrometer.observation.ObservationRegistry getObservationRegistry() -
setApplicationEventPublisher
- Specified by:
setApplicationEventPublisher
in interfaceApplicationEventPublisherAware
-
isRunning
public boolean isRunning() -
setRunning
protected void setRunning(boolean running) -
getApplicationEventPublisher
Get the event publisher.- Returns:
- the publisher
-
setBeanName
- Specified by:
setBeanName
in interfaceBeanNameAware
-
getBeanName
Return the bean name.- Returns:
- the bean name.
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Throws:
BeansException
-
getApplicationContext
-
setupMessageListener
- Specified by:
setupMessageListener
in interfacePulsarMessageListenerContainer
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartup
in interfaceSmartLifecycle
-
setAutoStartup
public void setAutoStartup(boolean autoStartup) - Specified by:
setAutoStartup
in interfaceMessageListenerContainer
-
setPhase
public void setPhase(int phase) -
getPhase
public int getPhase()- Specified by:
getPhase
in interfacePhased
- Specified by:
getPhase
in 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:
setNegativeAckRedeliveryBackoff
in interfacePulsarMessageListenerContainer
-
setAckTimeoutRedeliveryBackoff
public void setAckTimeoutRedeliveryBackoff(org.apache.pulsar.client.api.RedeliveryBackoff redeliveryBackoff) - Specified by:
setAckTimeoutRedeliveryBackoff
in 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:
setDeadLetterPolicy
in interfacePulsarMessageListenerContainer
-
getDeadLetterPolicy
public org.apache.pulsar.client.api.DeadLetterPolicy getDeadLetterPolicy() -
getPulsarConsumerErrorHandler
-
setPulsarConsumerErrorHandler
- Specified by:
setPulsarConsumerErrorHandler
in interfacePulsarMessageListenerContainer
-