org.springframework.integration.bus
Class DefaultMessageBus
java.lang.Object
org.springframework.integration.bus.DefaultMessageBus
- All Implemented Interfaces:
- java.util.EventListener, org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener, org.springframework.context.Lifecycle, MessageBus, ChannelRegistry, EndpointRegistry
public class DefaultMessageBus
- extends java.lang.Object
- implements MessageBus, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener
The messaging bus. Serves as a registry for channels and endpoints, manages their lifecycle,
and activates subscriptions.
- Author:
- Mark Fisher, Marius Bogoevici
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_DISPATCHER_POOL_SIZE
private static final int DEFAULT_DISPATCHER_POOL_SIZE
- See Also:
- Constant Field Values
logger
private final org.apache.commons.logging.Log logger
channelRegistry
private final ChannelRegistry channelRegistry
endpointRegistry
private final EndpointRegistry endpointRegistry
pollingDispatchers
private final java.util.Set<PollingDispatcher> pollingDispatchers
defaultPollerSchedule
private volatile Schedule defaultPollerSchedule
lifecycleEndpoints
private final java.util.List<org.springframework.context.Lifecycle> lifecycleEndpoints
interceptors
private final DefaultMessageBus.MessageBusInterceptorsList interceptors
taskScheduler
private volatile TaskScheduler taskScheduler
applicationContext
private volatile org.springframework.context.ApplicationContext applicationContext
configureAsyncEventMulticaster
private volatile boolean configureAsyncEventMulticaster
autoStartup
private volatile boolean autoStartup
initialized
private volatile boolean initialized
initializing
private volatile boolean initializing
starting
private volatile boolean starting
running
private volatile boolean running
lifecycleMonitor
private final java.lang.Object lifecycleMonitor
DefaultMessageBus
public DefaultMessageBus()
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
- Specified by:
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
setTaskScheduler
public void setTaskScheduler(TaskScheduler taskScheduler)
- Set the
TaskScheduler
to use for scheduling message dispatchers.
setAutoStartup
public void setAutoStartup(boolean autoStartup)
- Set whether to automatically start the bus after initialization.
Default is 'true'; set this to 'false' to allow for manual startup
through the start()
method.
setConfigureAsyncEventMulticaster
public void setConfigureAsyncEventMulticaster(boolean configureAsyncEventMulticaster)
- Set whether the bus should configure its asynchronous task executor
to also be used by the ApplicationContext's 'applicationEventMulticaster'.
This will only apply if the multicaster defined within the context
is an instance of SimpleApplicationEventMulticaster (the default).
This property is 'false' by default.
registerChannels
private void registerChannels(org.springframework.context.ApplicationContext context)
registerEndpoints
private void registerEndpoints(org.springframework.context.ApplicationContext context)
registerGateways
private void registerGateways(org.springframework.context.ApplicationContext context)
initialize
public void initialize()
getErrorChannel
public MessageChannel getErrorChannel()
- Specified by:
getErrorChannel
in interface MessageBus
lookupChannel
public MessageChannel lookupChannel(java.lang.String channelName)
- Specified by:
lookupChannel
in interface ChannelRegistry
registerChannel
public void registerChannel(MessageChannel channel)
- Specified by:
registerChannel
in interface ChannelRegistry
unregisterChannel
public MessageChannel unregisterChannel(java.lang.String name)
- Specified by:
unregisterChannel
in interface ChannelRegistry
registerEndpoint
public void registerEndpoint(MessageEndpoint endpoint)
- Specified by:
registerEndpoint
in interface EndpointRegistry
unregisterEndpoint
public MessageEndpoint unregisterEndpoint(java.lang.String name)
- Specified by:
unregisterEndpoint
in interface EndpointRegistry
lookupEndpoint
public MessageEndpoint lookupEndpoint(java.lang.String endpointName)
- Specified by:
lookupEndpoint
in interface EndpointRegistry
getEndpointNames
public java.util.Set<java.lang.String> getEndpointNames()
- Specified by:
getEndpointNames
in interface EndpointRegistry
activateEndpoints
private void activateEndpoints()
activateEndpoint
private void activateEndpoint(MessageEndpoint endpoint)
registerGateway
private void registerGateway(java.lang.String name,
MessagingGateway gateway)
deactivateEndpoint
public void deactivateEndpoint(MessageEndpoint endpoint)
isRunning
public boolean isRunning()
- Specified by:
isRunning
in interface org.springframework.context.Lifecycle
start
public void start()
- Specified by:
start
in interface org.springframework.context.Lifecycle
stop
public void stop()
- Specified by:
stop
in interface org.springframework.context.Lifecycle
destroy
public void destroy()
throws java.lang.Exception
- Specified by:
destroy
in interface org.springframework.beans.factory.DisposableBean
- Throws:
java.lang.Exception
onApplicationEvent
public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
- Specified by:
onApplicationEvent
in interface org.springframework.context.ApplicationListener
doConfigureAsyncEventMulticaster
private void doConfigureAsyncEventMulticaster(org.springframework.context.ApplicationContext context)
addInterceptor
public void addInterceptor(MessageBusInterceptor interceptor)
removeInterceptor
public void removeInterceptor(MessageBusInterceptor interceptor)
setInterceptors
public void setInterceptors(java.util.List<MessageBusInterceptor> interceptor)