org.springframework.integration.dispatcher
Class AbstractDispatcher

java.lang.Object
  extended by org.springframework.integration.dispatcher.AbstractDispatcher
All Implemented Interfaces:
MessageDispatcher, MessageSource, MessageTarget, SubscribableSource
Direct Known Subclasses:
BroadcastingDispatcher, SimpleDispatcher

public abstract class AbstractDispatcher
extends java.lang.Object
implements MessageDispatcher

Base class for MessageDispatcher implementations.

Author:
Mark Fisher

Field Summary
protected  org.apache.commons.logging.Log logger
           
private  MessageExchangeTemplate messageExchangeTemplate
           
protected  java.util.Set<MessageTarget> targets
           
private  org.springframework.core.task.TaskExecutor taskExecutor
           
 
Constructor Summary
AbstractDispatcher()
           
 
Method Summary
protected  org.springframework.core.task.TaskExecutor getTaskExecutor()
           
protected  boolean sendMessageToTarget(Message<?> message, MessageTarget target)
          A convenience method for subclasses to send a Message to a single target.
 void setSendTimeout(long sendTimeout)
          Specify the timeout for sending to a target (in milliseconds).
 void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
          Specify a TaskExecutor for invoking the target endpoints.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.integration.dispatcher.MessageDispatcher
send
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger

targets

protected final java.util.Set<MessageTarget> targets

taskExecutor

private volatile org.springframework.core.task.TaskExecutor taskExecutor

messageExchangeTemplate

private final MessageExchangeTemplate messageExchangeTemplate
Constructor Detail

AbstractDispatcher

public AbstractDispatcher()
Method Detail

setSendTimeout

public void setSendTimeout(long sendTimeout)
Description copied from interface: MessageDispatcher
Specify the timeout for sending to a target (in milliseconds). Note that this value will only be applicable for blocking targets.

Specified by:
setSendTimeout in interface MessageDispatcher

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 MessageDispatcher
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 MessageDispatcher
Specified by:
unsubscribe in interface SubscribableSource

setTaskExecutor

public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
Specify a TaskExecutor for invoking the target endpoints. If none is provided, the invocation will occur in the thread that runs this polling dispatcher.


getTaskExecutor

protected org.springframework.core.task.TaskExecutor getTaskExecutor()

sendMessageToTarget

protected final boolean sendMessageToTarget(Message<?> message,
                                            MessageTarget target)
A convenience method for subclasses to send a Message to a single target.