org.springframework.integration.channel
Class ExecutorChannel
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.channel.AbstractMessageChannel
org.springframework.integration.channel.AbstractSubscribableChannel
org.springframework.integration.channel.ExecutorChannel
- All Implemented Interfaces:
- org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, NamedComponent, SubscribableChannel, TrackableComponent, MessageChannel
public class ExecutorChannel
- extends AbstractSubscribableChannel
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
Constructor Summary |
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. |
Method Summary |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ExecutorChannel
public ExecutorChannel(java.util.concurrent.Executor executor)
- Create an ExecutorChannel that delegates to the provided
Executor
when dispatching Messages.
The Executor must not be null.
ExecutorChannel
public ExecutorChannel(java.util.concurrent.Executor executor,
LoadBalancingStrategy loadBalancingStrategy)
- Create an ExecutorChannel with a
LoadBalancingStrategy
that
delegates to the provided Executor
when dispatching Messages.
The Executor must not be null.
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.
setMaxSubscribers
public void setMaxSubscribers(int maxSubscribers)
- Specify the maximum number of subscribers supported by the
channel's dispatcher.
- Parameters:
maxSubscribers
-
getDispatcher
protected UnicastingDispatcher getDispatcher()
- Specified by:
getDispatcher
in class AbstractSubscribableChannel
onInit
public final void onInit()
- Description copied from class:
IntegrationObjectSupport
- Subclasses may implement this for initialization logic.
- Overrides:
onInit
in class IntegrationObjectSupport