Class GenericReaderEndpointRegistry<C extends PulsarMessageReaderContainer,E extends PulsarReaderEndpoint<C>>
java.lang.Object
org.springframework.pulsar.config.GenericReaderEndpointRegistry<C,E>
- Type Parameters:
C
- container typeE
- endpoint type
- All Implemented Interfaces:
EventListener
,Aware
,DisposableBean
,ApplicationContextAware
,ApplicationListener<ContextRefreshedEvent>
,Lifecycle
,Phased
,SmartLifecycle
,PulsarReaderContainerRegistry
- Direct Known Subclasses:
PulsarReaderEndpointRegistry
public class GenericReaderEndpointRegistry<C extends PulsarMessageReaderContainer,E extends PulsarReaderEndpoint<C>>
extends Object
implements PulsarReaderContainerRegistry, DisposableBean, SmartLifecycle, ApplicationContextAware, ApplicationListener<ContextRefreshedEvent>
Creates the necessary container instances for the registered
endpoints. Also manages the lifecycle of the reader
containers, in particular within the lifecycle of the application context.
Contrary to containers created manually, reader listener containers managed by registry
are not beans in the application context and are not candidates for autowiring. Use
getReaderContainers()
()} if you need to access this registry's reader
listener containers for management purposes. If you need to access to a specific reader
listener container, use getReaderContainer(String)
with the id of the
endpoint.
- Author:
- Soby Chacko
-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected C
createReaderContainer
(E endpoint, ReaderContainerFactory<? extends C, E> factory) void
destroy()
int
getPhase()
boolean
boolean
void
void
registerReaderContainer
(E endpoint, ReaderContainerFactory<? extends C, E> factory) void
registerReaderContainer
(E endpoint, ReaderContainerFactory<? extends C, E> factory, boolean startImmediately) void
setApplicationContext
(ApplicationContext applicationContext) void
start()
void
stop()
void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
GenericReaderEndpointRegistry
-
-
Method Details
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Throws:
BeansException
-
getReaderContainer
- Specified by:
getReaderContainer
in interfacePulsarReaderContainerRegistry
-
getReaderContainerIds
- Specified by:
getReaderContainerIds
in interfacePulsarReaderContainerRegistry
-
getReaderContainers
- Specified by:
getReaderContainers
in interfacePulsarReaderContainerRegistry
-
getAllReaderContainers
- Specified by:
getAllReaderContainers
in interfacePulsarReaderContainerRegistry
-
registerReaderContainer
-
registerReaderContainer
public void registerReaderContainer(E endpoint, ReaderContainerFactory<? extends C, E> factory, boolean startImmediately) -
createReaderContainer
-
destroy
- Specified by:
destroy
in interfaceDisposableBean
- Throws:
Exception
-
getPhase
public int getPhase()- Specified by:
getPhase
in interfacePhased
- Specified by:
getPhase
in interfaceSmartLifecycle
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartup
in interfaceSmartLifecycle
-
start
public void start() -
stop
public void stop() -
stop
- Specified by:
stop
in interfaceSmartLifecycle
-
isRunning
public boolean isRunning() -
onApplicationEvent
- Specified by:
onApplicationEvent
in interfaceApplicationListener<C extends PulsarMessageReaderContainer>
-