org.springframework.integration.dispatcher
Class AbstractUnicastDispatcher
java.lang.Object
org.springframework.integration.dispatcher.AbstractDispatcher
org.springframework.integration.dispatcher.AbstractUnicastDispatcher
- All Implemented Interfaces:
- MessageDispatcher
- Direct Known Subclasses:
- FailOverDispatcher, RoundRobinDispatcher
public abstract class AbstractUnicastDispatcher
- extends AbstractDispatcher
Implementation of MessageDispatcher
that will attempt to send a
Message
to at most one of its handlers. The handlers will be tried
one by one. 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 reject the Message, the dispatcher will throw a
MessageRejectedException
.
The implementations of this class control the order in which the handlers
will be tried through the implementation of the getHandlerIterator(List)
method.
- Since:
- 1.0.2
- Author:
- Iwein Fuld, Mark Fisher
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
AbstractUnicastDispatcher
public AbstractUnicastDispatcher()
dispatch
public final boolean dispatch(Message<?> message)
getHandlerIterator
protected abstract java.util.Iterator<MessageHandler> getHandlerIterator(java.util.List<MessageHandler> handlers)
- Return the iterator that will be used to loop over the handlers. This
allows subclasses to control the order of iteration for each
dispatch(Message)
invocation.
- Parameters:
handlers
- all handlers for this dispatcher