org.springframework.integration.dispatcher
Class DefaultPollingDispatcher
java.lang.Object
org.springframework.integration.dispatcher.SimpleDispatcher
org.springframework.integration.dispatcher.DefaultPollingDispatcher
- All Implemented Interfaces:
- MessageDispatcher, PollingDispatcher, Poller, Subscribable
public class DefaultPollingDispatcher
- extends SimpleDispatcher
- implements PollingDispatcher
A subclass of SimpleDispatcher
that adds message retrieval
capabilities by polling a PollableSource
for Messages
.
The number of messages retrieved per poll is limited by the 'maxMessagesPerTask'
property of the provided DispatcherPolicy
, and the timeout for each
receive call is determined by the policy's 'receiveTimeout'
property. In general, it is recommended to use a value of 1 (the default) for
'maxMessagesPerTask' whenever a significant timeout is provided. Otherwise
the poller may be holding on to available messages while waiting for
additional messages. Note that the 'timeout' value is only relevant if the
specified source is an implementation of BlockingSource
. The default
timeout value is 0 indicating that the method should return immediately
rather than waiting for a Message
to become available.
- Author:
- Mark Fisher
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
source
private final Source<?> source
DefaultPollingDispatcher
public DefaultPollingDispatcher(MessageChannel channel)
DefaultPollingDispatcher
public DefaultPollingDispatcher(Source<?> source,
DispatcherPolicy dispatcherPolicy)
dispatch
public boolean dispatch(Message<?> message)
- Specified by:
dispatch
in interface MessageDispatcher
- Overrides:
dispatch
in class SimpleDispatcher
poll
public java.util.List<Message<?>> poll()
- Specified by:
poll
in interface Poller