public class ExecutorChannel extends AbstractSubscribableChannel
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).
AbstractMessageChannel.ChannelInterceptorList
logger
Constructor and Description |
---|
ExecutorChannel(java.util.concurrent.Executor executor)
Create an ExecutorChannel that delegates to the provided
Executor when dispatching Messages. |
ExecutorChannel(java.util.concurrent.Executor executor,
LoadBalancingStrategy loadBalancingStrategy)
Create an ExecutorChannel with a
LoadBalancingStrategy that
delegates to the provided Executor when dispatching Messages. |
Modifier and Type | Method and 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.
|
void |
setMaxSubscribers(int maxSubscribers)
Specify the maximum number of subscribers supported by the
channel's dispatcher.
|
doSend, subscribe, unsubscribe
addInterceptor, getComponentType, getFullChannelName, getInterceptors, send, send, setConversionService, setDatatypes, setInterceptors, setShouldTrack
afterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getConversionService, getIntegrationProperties, getIntegrationProperty, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
send, send
getComponentName
public ExecutorChannel(java.util.concurrent.Executor executor)
Executor
when dispatching Messages.
The Executor must not be null.
public ExecutorChannel(java.util.concurrent.Executor executor, LoadBalancingStrategy loadBalancingStrategy)
LoadBalancingStrategy
that
delegates to the provided Executor
when dispatching Messages.
The Executor must not be null.
public void setFailover(boolean failover)
public void setMaxSubscribers(int maxSubscribers)
maxSubscribers
- protected UnicastingDispatcher getDispatcher()
getDispatcher
in class AbstractSubscribableChannel
public final void onInit()
IntegrationObjectSupport
onInit
in class IntegrationObjectSupport