org.springframework.integration.dispatcher
Class BroadcastingDispatcher
java.lang.Object
org.springframework.integration.dispatcher.AbstractDispatcher
org.springframework.integration.dispatcher.BroadcastingDispatcher
- All Implemented Interfaces:
- MessageDispatcher
public class BroadcastingDispatcher
- extends AbstractDispatcher
A broadcasting dispatcher implementation. If the 'ignoreFailures' property
is set to false
(the default), it will fail fast such that any
Exception thrown by a MessageHandler may prevent subsequent handlers from
receiving the Message. However, when a TaskExecutor is provided, the Messages
may be dispatched in separate Threads so that other handlers are invoked even
when the 'ignoreFailures' flag is false
.
If the 'ignoreFailures' flag is set to true
on the other hand,
it will make a best effort to send the message to each of its handlers. In
other words, when 'ignoreFailures' is true
, if it fails to send
to any one handler, it will simply log a warn-level message but continue to
send the Message to any other handlers.
- Author:
- Mark Fisher, Iwein Fuld
Method Summary |
boolean |
dispatch(Message<?> message)
|
void |
setApplySequence(boolean applySequence)
Specify whether to apply sequence numbers to the messages
prior to sending to the handlers. |
void |
setIgnoreFailures(boolean ignoreFailures)
Specify whether failures for one or more of the handlers should be
ignored. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
BroadcastingDispatcher
public BroadcastingDispatcher()
BroadcastingDispatcher
public BroadcastingDispatcher(org.springframework.core.task.TaskExecutor taskExecutor)
setIgnoreFailures
public void setIgnoreFailures(boolean ignoreFailures)
- Specify whether failures for one or more of the handlers should be
ignored. By default this is
false
meaning that an
Exception will be thrown when a handler fails. To override this and
suppress Exceptions, set the value to true
.
Keep in mind that when using a TaskExecutor, even without ignoring the
failures, other handlers may be invoked after one throws an Exception.
Since the TaskExecutor is using a different thread, this flag will only
affect whether an error Message is sent to the error channel or not in
the case that a TaskExecutor has been configured.
setApplySequence
public void setApplySequence(boolean applySequence)
- Specify whether to apply sequence numbers to the messages
prior to sending to the handlers. By default, sequence
numbers will not be applied
dispatch
public boolean dispatch(Message<?> message)