Class GenericListenerEndpointRegistry<C extends MessageListenerContainer,E extends ListenerEndpoint<C>>
java.lang.Object
org.springframework.pulsar.config.GenericListenerEndpointRegistry<C,E>
- Type Parameters:
C- listener container type.E- listener endpoint type.
- All Implemented Interfaces:
EventListener,org.springframework.beans.factory.Aware,org.springframework.beans.factory.DisposableBean,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle,PulsarListenerContainerRegistry
- Direct Known Subclasses:
PulsarListenerEndpointRegistry
public class GenericListenerEndpointRegistry<C extends MessageListenerContainer,E extends ListenerEndpoint<C>>
extends Object
implements PulsarListenerContainerRegistry, org.springframework.beans.factory.DisposableBean, org.springframework.context.SmartLifecycle, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
Creates the necessary container instances for the registered
endpoints. Also manages the lifecycle of the listener
containers, in particular within the lifecycle of the application context.
Contrary to containers created manually, listener containers managed by registry are
not beans in the application context and are not candidates for autowiring. Use
getListenerContainers() if you need to access this registry's listener
containers for management purposes. If you need to access to a specific message
listener container, use getListenerContainer(String) with the id of the
endpoint.
-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CcreateListenerContainer(E endpoint, ListenerContainerFactory<? extends C, E> factory) voiddestroy()Return all listener container instances including those managed by this registry and those declared as beans in the application context.Return the listener container with the specified id ornullif no such container exists.Return the ids of the managed listener container instance(s).Return the managed listener container instance(s).intgetPhase()booleanbooleanvoidonApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) voidregisterListenerContainer(E endpoint, ListenerContainerFactory<? extends C, E> factory) voidregisterListenerContainer(E endpoint, ListenerContainerFactory<? extends C, E> factory, boolean startImmediately) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidstart()voidstop()voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
GenericListenerEndpointRegistry
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
getListenerContainer
Description copied from interface:PulsarListenerContainerRegistryReturn the listener container with the specified id ornullif no such container exists.- Specified by:
getListenerContainerin interfacePulsarListenerContainerRegistry- Parameters:
id- the id of the container- Returns:
- the container or
nullif no container with that id exists - See Also:
-
getListenerContainerIds
Description copied from interface:PulsarListenerContainerRegistryReturn the ids of the managed listener container instance(s).- Specified by:
getListenerContainerIdsin interfacePulsarListenerContainerRegistry- Returns:
- the ids.
- See Also:
-
getListenerContainers
Description copied from interface:PulsarListenerContainerRegistryReturn the managed listener container instance(s).- Specified by:
getListenerContainersin interfacePulsarListenerContainerRegistry- Returns:
- the managed listener container instance(s).
- See Also:
-
getAllListenerContainers
Description copied from interface:PulsarListenerContainerRegistryReturn all listener container instances including those managed by this registry and those declared as beans in the application context. Prototype-scoped containers will be included. Lazy beans that have not yet been created will not be initialized by a call to this method.- Specified by:
getAllListenerContainersin interfacePulsarListenerContainerRegistry- Returns:
- the listener container instance(s).
- See Also:
-
registerListenerContainer
-
registerListenerContainer
public void registerListenerContainer(E endpoint, ListenerContainerFactory<? extends C, E> factory, boolean startImmediately) -
createListenerContainer
-
destroy
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Throws:
Exception
-
getPhase
public int getPhase()- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartupin interfaceorg.springframework.context.SmartLifecycle
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
stop
- Specified by:
stopin interfaceorg.springframework.context.SmartLifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) - Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<C extends MessageListenerContainer>
-