org.springframework.integration.dispatcher
Class SimpleDispatcher

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

public class SimpleDispatcher
extends AbstractDispatcher

Basic implementation of MessageDispatcher that will attempt to send a Message to one of its targets. As soon as one of the targets accepts the Message, the dispatcher will return 'true'.

If all targets reject the Message, the dispatcher will throw a MessageRejectedException. If all targets return 'false' (e.g. due to a timeout), the dispatcher will return 'false'.

Author:
Mark Fisher

Field Summary
 
Fields inherited from class org.springframework.integration.dispatcher.AbstractDispatcher
logger, targets
 
Constructor Summary
SimpleDispatcher()
           
 
Method Summary
 boolean send(Message<?> message)
          Send a Message to this target.
 
Methods inherited from class org.springframework.integration.dispatcher.AbstractDispatcher
getTaskExecutor, sendMessageToTarget, setSendTimeout, setTaskExecutor, subscribe, unsubscribe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDispatcher

public SimpleDispatcher()
Method Detail

send

public boolean send(Message<?> message)
Description copied from interface: MessageTarget
Send a Message to this target. May throw a RuntimeException for non-recoverable errors. Otherwise, if the Message cannot be sent for a non-fatal reason such as timeout, then this method will return 'false', and if the Message is sent successfully, it will return 'true'.

Parameters:
message - the Message to send
Returns:
whether the Message has been sent successfully