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, ComponentSourceAware, ExpressionCapable, IntegrationPattern, NamedComponent, IntegrationManagement, SubscribableChannelManagement, TrackableComponent, MessageChannel, SubscribableChannel, InterceptableChannel
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 AbstractExecutorChannel
AbstractExecutorChannel.MessageHandlingTaskNested classes/interfaces inherited from class AbstractMessageChannel
AbstractMessageChannel.ChannelInterceptorListNested classes/interfaces inherited from interface IntegrationManagement
IntegrationManagement.ManagementOverrides -
Field Summary
Fields inherited from class AbstractExecutorChannel
dispatcher, executor, executorInterceptorsSize, maxSubscribersFields inherited from class AbstractMessageChannel
interceptors, metersFields inherited from class IntegrationObjectSupport
EXPRESSION_PARSER, loggerFields inherited from interface IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface MessageChannel
INDEFINITE_TIMEOUT -
Constructor Summary
ConstructorsConstructorDescriptionExecutorChannel(Executor executor) Create an ExecutorChannel that delegates to the providedExecutorwhen dispatching Messages.ExecutorChannel(Executor executor, @Nullable LoadBalancingStrategy loadBalancingStrategy) Create an ExecutorChannel with aLoadBalancingStrategythat delegates to the providedExecutorwhen dispatching Messages. -
Method Summary
Modifier and TypeMethodDescriptionprotected UnicastingDispatcherfinal voidonInit()Subclasses may implement this for initialization logic.voidsetFailover(boolean failover) Specify whether the channel's dispatcher should have failover enabled.voidsetFailoverStrategy(Predicate<Exception> failoverStrategy) Configure a strategy whether the channel's dispatcher should have failover enabled for the exception thrown.Methods inherited from class AbstractExecutorChannel
addInterceptor, addInterceptor, getIntegrationPatternType, hasExecutorInterceptors, removeInterceptor, removeInterceptor, setInterceptors, setMaxSubscribersMethods inherited from class AbstractSubscribableChannel
doSend, getSubscriberCount, subscribe, unsubscribeMethods inherited from class AbstractMessageChannel
destroy, getComponentType, getFullChannelName, getIChannelInterceptorList, getInterceptors, getMetricsCaptor, getOverrides, isApplicationRunning, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, send, send, setDatatypes, setLoggingEnabled, setMessageConverter, setObservationConvention, setShouldTrackMethods inherited from class IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IntegrationManagement
getManagedName, getManagedType, getThisAs, setManagedName, setManagedTypeMethods inherited from interface InterceptableChannel
getInterceptorsMethods inherited from interface MessageChannel
send, sendMethods inherited from interface NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
ExecutorChannel
-
ExecutorChannel
Create an ExecutorChannel with aLoadBalancingStrategythat delegates to the providedExecutorwhen 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.
-
setFailoverStrategy
Configure a strategy whether the channel's dispatcher should have failover enabled for the exception thrown. OverridessetFailover(boolean)option. In other words: or this, or that option has to be set.- Parameters:
failoverStrategy- The failover strategy predicate.- Since:
- 6.3
-
getDispatcher
- Specified by:
getDispatcherin classAbstractSubscribableChannel
-
onInit
public final void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
onInitin classAbstractMessageChannel
-