Package org.springframework.jms.config
Class JmsListenerEndpointRegistry
java.lang.Object
org.springframework.jms.config.JmsListenerEndpointRegistry
- 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
public class JmsListenerEndpointRegistry
extends Object
implements 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
MessageListenerContainer instances for the
registered endpoints. Also manages the
lifecycle of the listener containers, in particular within the lifecycle
of the application context.
Contrary to MessageListenerContainers
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.
- Since:
- 4.1
- Author:
- Stephane Nicoll, Juergen Hoeller
- See Also:
-
Field Summary
FieldsFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected MessageListenerContainercreateListenerContainer(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory) Create and start a new container using the specified factory.voiddestroy()Return theMessageListenerContainerwith the specified id ornullif no such container exists.Return the ids of the managedMessageListenerContainerinstance(s).Return the managedMessageListenerContainerinstance(s).intgetPhase()booleanvoidonApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) voidregisterListenerContainer(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory) Create a message listener container for the givenJmsListenerEndpoint.voidregisterListenerContainer(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory, boolean startImmediately) Create a message listener container for the givenJmsListenerEndpoint.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
supportsAsyncExecutionMethods inherited from interface org.springframework.context.SmartLifecycle
isAutoStartup
-
Field Details
-
logger
protected final org.apache.commons.logging.Log logger
-
-
Constructor Details
-
JmsListenerEndpointRegistry
public JmsListenerEndpointRegistry()
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) - Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
-
getListenerContainer
Return theMessageListenerContainerwith the specified id ornullif no such container exists.- Parameters:
id- the id of the container- Returns:
- the container or
nullif no container with that id exists - See Also:
-
getListenerContainerIds
Return the ids of the managedMessageListenerContainerinstance(s).- Since:
- 4.2.3
- See Also:
-
getListenerContainers
Return the managedMessageListenerContainerinstance(s). -
registerListenerContainer
public void registerListenerContainer(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory, boolean startImmediately) Create a message listener container for the givenJmsListenerEndpoint.This create the necessary infrastructure to honor that endpoint with regard to its configuration.
The
startImmediatelyflag determines if the container should be started immediately.- Parameters:
endpoint- the endpoint to addfactory- the listener factory to usestartImmediately- start the container immediately if necessary- See Also:
-
registerListenerContainer
public void registerListenerContainer(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory) Create a message listener container for the givenJmsListenerEndpoint.This create the necessary infrastructure to honor that endpoint with regard to its configuration.
- Parameters:
endpoint- the endpoint to addfactory- the listener factory to use- See Also:
-
createListenerContainer
protected MessageListenerContainer createListenerContainer(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory) Create and start a new container using the specified factory. -
getPhase
public int getPhase()- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein 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
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-