Class ExecutorChannel
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.channel.AbstractMessageChannel
org.springframework.integration.channel.AbstractSubscribableChannel
org.springframework.integration.channel.AbstractExecutorChannel
org.springframework.integration.channel.ExecutorChannel
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,BeanNameAware
,DisposableBean
,InitializingBean
,ApplicationContextAware
,ExecutorChannelInterceptorAware
,ExpressionCapable
,IntegrationPattern
,NamedComponent
,IntegrationManagement
,SubscribableChannelManagement
,TrackableComponent
,MessageChannel
,SubscribableChannel
,InterceptableChannel
public class ExecutorChannel extends AbstractExecutorChannel
An implementation of
MessageChannel
that delegates to an instance of
UnicastingDispatcher
which in turn delegates all dispatching
invocations to an Executor
.
NOTE: unlike DirectChannel, the ExecutorChannel does not support a
shared transactional context between sender and handler, because the
Executor
typically does not block the sender's Thread since it
uses another Thread for the dispatch. (SyncTaskExecutor is an
exception but would provide no value for this channel. If synchronous
dispatching is required, a DirectChannel should be used instead).
- Since:
- 1.0.3
- Author:
- Mark Fisher, Gary Russell, Artem Bilan
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.channel.AbstractExecutorChannel
AbstractExecutorChannel.MessageHandlingTask
Nested classes/interfaces inherited from class org.springframework.integration.channel.AbstractMessageChannel
AbstractMessageChannel.ChannelInterceptorList
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides
-
Field Summary
Fields inherited from class org.springframework.integration.channel.AbstractExecutorChannel
dispatcher, executor, executorInterceptorsSize, maxSubscribers
Fields inherited from class org.springframework.integration.channel.AbstractMessageChannel
interceptors, meters
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
-
Constructor Summary
Constructors Constructor Description ExecutorChannel(Executor executor)
Create an ExecutorChannel that delegates to the providedExecutor
when dispatching Messages.ExecutorChannel(Executor executor, LoadBalancingStrategy loadBalancingStrategy)
Create an ExecutorChannel with aLoadBalancingStrategy
that delegates to the providedExecutor
when dispatching Messages. -
Method Summary
Modifier and Type Method Description protected UnicastingDispatcher
getDispatcher()
void
onInit()
Subclasses may implement this for initialization logic.void
setFailover(boolean failover)
Specify whether the channel's dispatcher should have failover enabled.Methods inherited from class org.springframework.integration.channel.AbstractExecutorChannel
addInterceptor, addInterceptor, getIntegrationPatternType, hasExecutorInterceptors, removeInterceptor, removeInterceptor, setInterceptors, setMaxSubscribers
Methods inherited from class org.springframework.integration.channel.AbstractSubscribableChannel
doSend, getSubscriberCount, subscribe, unsubscribe
Methods inherited from class org.springframework.integration.channel.AbstractMessageChannel
destroy, getComponentType, getFullChannelName, getIChannelInterceptorList, getInterceptors, getMetricsCaptor, getOverrides, isLoggingEnabled, registerMetricsCaptor, send, send, setDatatypes, setLoggingEnabled, setMessageConverter, setShouldTrack
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getManagedName, getManagedType, getThisAs, setManagedName, setManagedType
Methods inherited from interface org.springframework.messaging.support.InterceptableChannel
getInterceptors
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
ExecutorChannel
Create an ExecutorChannel that delegates to the providedExecutor
when dispatching Messages.The Executor must not be null.
- Parameters:
executor
- The executor.
-
ExecutorChannel
Create an ExecutorChannel with aLoadBalancingStrategy
that delegates to the providedExecutor
when dispatching Messages.The Executor must not be null.
- Parameters:
executor
- The executor.loadBalancingStrategy
- The load balancing strategy implementation.
-
-
Method Details
-
setFailover
public void setFailover(boolean failover)Specify whether the channel's dispatcher should have failover enabled. By default, it will. Set this value to 'false' to disable it.- Parameters:
failover
- The failover boolean.
-
getDispatcher
- Specified by:
getDispatcher
in classAbstractSubscribableChannel
-
onInit
public final void onInit()Description copied from class:IntegrationObjectSupport
Subclasses may implement this for initialization logic.- Overrides:
onInit
in classAbstractMessageChannel
-