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>
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.
JmsListenerEndpoint,
MessageListenerContainer,
JmsListenerContainerFactory| Constructor and Description |
|---|
JmsListenerEndpointRegistry() |
| Modifier and Type | Method and Description |
|---|---|
protected MessageListenerContainer |
createListenerContainer(JmsListenerEndpoint endpoint,
JmsListenerContainerFactory<?> factory)
Create and start a new container using the specified factory.
|
void |
destroy() |
MessageListenerContainer |
getListenerContainer(String id)
Return the
MessageListenerContainer with the specified id or
null if no such container exists. |
Set<String> |
getListenerContainerIds()
Return the ids of the managed
MessageListenerContainer instance(s). |
Collection<MessageListenerContainer> |
getListenerContainers()
Return the managed
MessageListenerContainer instance(s). |
int |
getPhase() |
boolean |
isRunning() |
void |
onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) |
void |
registerListenerContainer(JmsListenerEndpoint endpoint,
JmsListenerContainerFactory<?> factory)
Create a message listener container for the given
JmsListenerEndpoint. |
void |
registerListenerContainer(JmsListenerEndpoint endpoint,
JmsListenerContainerFactory<?> factory,
boolean startImmediately)
Create a message listener container for the given
JmsListenerEndpoint. |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
protected final Log logger
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext in interface org.springframework.context.ApplicationContextAwarepublic void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>@Nullable public MessageListenerContainer getListenerContainer(String id)
MessageListenerContainer with the specified id or
null if no such container exists.id - the id of the containernull if no container with that id existsJmsListenerEndpoint.getId(),
getListenerContainerIds()public Set<String> getListenerContainerIds()
MessageListenerContainer instance(s).getListenerContainer(String)public Collection<MessageListenerContainer> getListenerContainers()
MessageListenerContainer instance(s).public void registerListenerContainer(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory, boolean startImmediately)
JmsListenerEndpoint.
This create the necessary infrastructure to honor that endpoint with regards to its configuration.
The startImmediately flag determines if the container should be
started immediately.
endpoint - the endpoint to addfactory - the listener factory to usestartImmediately - start the container immediately if necessarygetListenerContainers(),
getListenerContainer(String)public void registerListenerContainer(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory)
JmsListenerEndpoint.
This create the necessary infrastructure to honor that endpoint with regards to its configuration.
endpoint - the endpoint to addfactory - the listener factory to useregisterListenerContainer(JmsListenerEndpoint, JmsListenerContainerFactory, boolean)protected MessageListenerContainer createListenerContainer(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> factory)
public int getPhase()
getPhase in interface org.springframework.context.PhasedgetPhase in interface org.springframework.context.SmartLifecyclepublic void start()
start in interface org.springframework.context.Lifecyclepublic void stop()
stop in interface org.springframework.context.Lifecyclepublic void stop(Runnable callback)
stop in interface org.springframework.context.SmartLifecyclepublic boolean isRunning()
isRunning in interface org.springframework.context.Lifecyclepublic void destroy()
destroy in interface org.springframework.beans.factory.DisposableBean