org.springframework.integration.channel
Class DirectChannel

java.lang.Object
  extended by org.springframework.integration.channel.AbstractMessageChannel
      extended by org.springframework.integration.channel.DirectChannel
All Implemented Interfaces:
org.springframework.beans.factory.BeanNameAware, MessageChannel, BlockingTarget, MessageSource, MessageTarget, SubscribableSource

public class DirectChannel
extends AbstractMessageChannel
implements SubscribableSource

A channel that invokes the subscribed target(s) in the sender's thread (returning after at most one handles the message).

Author:
Dave Syer, Mark Fisher

Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.integration.channel.AbstractMessageChannel
AbstractMessageChannel.ChannelInterceptorList
 
Field Summary
private  SimpleDispatcher dispatcher
           
 
Constructor Summary
DirectChannel()
           
 
Method Summary
protected  boolean doSend(Message<?> message, long timeout)
          Subclasses must implement this method.
 boolean subscribe(MessageTarget target)
          Register a MessageTarget as a subscriber to this source.
 boolean unsubscribe(MessageTarget target)
          Remove a MessageTarget from the subscribers of this source.
 
Methods inherited from class org.springframework.integration.channel.AbstractMessageChannel
addInterceptor, getInterceptors, getName, send, send, setBeanName, setInterceptors, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dispatcher

private final SimpleDispatcher dispatcher
Constructor Detail

DirectChannel

public DirectChannel()
Method Detail

subscribe

public boolean subscribe(MessageTarget target)
Description copied from interface: SubscribableSource
Register a MessageTarget as a subscriber to this source.

Specified by:
subscribe in interface SubscribableSource

unsubscribe

public boolean unsubscribe(MessageTarget target)
Description copied from interface: SubscribableSource
Remove a MessageTarget from the subscribers of this source.

Specified by:
unsubscribe in interface SubscribableSource

doSend

protected boolean doSend(Message<?> message,
                         long timeout)
Description copied from class: AbstractMessageChannel
Subclasses must implement this method. A non-negative timeout indicates how long to wait if the channel is at capacity (if the value is 0, it must return immediately with or without success). A negative timeout value indicates that the method should block until either the message is accepted or the blocking thread is interrupted.

Specified by:
doSend in class AbstractMessageChannel