Spring Integration

org.springframework.integration.dispatcher
Class UnicastingDispatcher

java.lang.Object
  extended by org.springframework.integration.dispatcher.AbstractDispatcher
      extended by org.springframework.integration.dispatcher.UnicastingDispatcher
All Implemented Interfaces:
MessageDispatcher

public class UnicastingDispatcher
extends AbstractDispatcher

Implementation of MessageDispatcher that will attempt to send a Message to at most one of its handlers. The handlers will be tried as determined by the LoadBalancingStrategy if one is configured. As soon as one of the handlers accepts the Message, the dispatcher will return true and ignore the rest of its handlers.

If the dispatcher has no handlers, a MessageDeliveryException will be thrown. If all handlers throw Exceptions, the dispatcher will throw an AggregateMessageDeliveryException.

A load-balancing strategy may be provided to this class to control the order in which the handlers will be tried.

Since:
1.0.2
Author:
Iwein Fuld, Mark Fisher, Gary Russell, Oleg Zhurakousky

Field Summary
 
Fields inherited from class org.springframework.integration.dispatcher.AbstractDispatcher
logger
 
Constructor Summary
UnicastingDispatcher()
           
UnicastingDispatcher(Executor executor)
           
 
Method Summary
 boolean dispatch(Message<?> message)
           
 void setFailover(boolean failover)
          Specify whether this dispatcher should failover when a single MessageHandler throws an Exception.
 void setLoadBalancingStrategy(LoadBalancingStrategy loadBalancingStrategy)
          Provide a LoadBalancingStrategy for this dispatcher.
 
Methods inherited from class org.springframework.integration.dispatcher.AbstractDispatcher
addHandler, getHandlers, removeHandler, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnicastingDispatcher

public UnicastingDispatcher()

UnicastingDispatcher

public UnicastingDispatcher(Executor executor)
Method Detail

setFailover

public void setFailover(boolean failover)
Specify whether this dispatcher should failover when a single MessageHandler throws an Exception. The default value is true.


setLoadBalancingStrategy

public void setLoadBalancingStrategy(LoadBalancingStrategy loadBalancingStrategy)
Provide a LoadBalancingStrategy for this dispatcher.


dispatch

public final boolean dispatch(Message<?> message)

Spring Integration

Copyright © 2010. All Rights Reserved.