org.springframework.integration.channel
Class ExecutorChannel

java.lang.Object
  extended by org.springframework.integration.channel.AbstractMessageChannel
      extended by org.springframework.integration.channel.AbstractSubscribableChannel
          extended by org.springframework.integration.channel.ExecutorChannel
All Implemented Interfaces:
org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, SubscribableChannel, MessageChannel

public class ExecutorChannel
extends AbstractSubscribableChannel
implements org.springframework.beans.factory.BeanFactoryAware

An implementation of MessageChannel that delegates to an instance of UnicastingDispatcher which in turn delegates all dispatching invocations to a TaskExecutor.

NOTE: unlike DirectChannel, the ExecutorChannel does not support a shared transactional context between sender and handler, because the TaskExecutor 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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.integration.channel.AbstractMessageChannel
AbstractMessageChannel.ChannelInterceptorList
 
Constructor Summary
ExecutorChannel(org.springframework.core.task.TaskExecutor taskExecutor)
          Create an ExecutorChannel that delegates to the provided TaskExecutor when dispatching Messages.
ExecutorChannel(org.springframework.core.task.TaskExecutor taskExecutor, LoadBalancingStrategy loadBalancingStrategy)
          Create an ExecutorChannel with a LoadBalancingStrategy that delegates to the provided TaskExecutor when dispatching Messages.
 
Method Summary
protected  UnicastingDispatcher getDispatcher()
           
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
           
 void setFailover(boolean failover)
          Specify whether the channel's dispatcher should have failover enabled.
 
Methods inherited from class org.springframework.integration.channel.AbstractSubscribableChannel
doSend, subscribe, unsubscribe
 
Methods inherited from class org.springframework.integration.channel.AbstractMessageChannel
addInterceptor, getInterceptors, getName, send, send, setBeanName, setConversionService, setDatatypes, setInterceptors, 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.core.MessageChannel
getName, send, send
 

Constructor Detail

ExecutorChannel

public ExecutorChannel(org.springframework.core.task.TaskExecutor taskExecutor)
Create an ExecutorChannel that delegates to the provided TaskExecutor when dispatching Messages.

The TaskExecutor must not be null.


ExecutorChannel

public ExecutorChannel(org.springframework.core.task.TaskExecutor taskExecutor,
                       LoadBalancingStrategy loadBalancingStrategy)
Create an ExecutorChannel with a LoadBalancingStrategy that delegates to the provided TaskExecutor when dispatching Messages.

The TaskExecutor must not be null.

Method Detail

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.


getDispatcher

protected UnicastingDispatcher getDispatcher()
Specified by:
getDispatcher in class AbstractSubscribableChannel

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
Overrides:
setBeanFactory in class AbstractMessageChannel