org.springframework.integration.dispatcher
Class PollingDispatcher
java.lang.Object
org.springframework.integration.dispatcher.PollingDispatcher
- All Implemented Interfaces:
- java.lang.Runnable, SchedulableTask
- Direct Known Subclasses:
- EndpointTrigger
public class PollingDispatcher
- extends java.lang.Object
- implements SchedulableTask
- Author:
- Mark Fisher
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
source
private final MessageSource<?> source
dispatcher
private final MessageDispatcher dispatcher
schedule
private final Schedule schedule
receiveTimeout
private volatile long receiveTimeout
maxMessagesPerTask
private volatile int maxMessagesPerTask
PollingDispatcher
public PollingDispatcher(MessageSource<?> source,
MessageDispatcher dispatcher,
Schedule schedule)
- Create a PollingDispatcher for the provided
MessageSource
.
It can be scheduled according to the specified Schedule
.
setReceiveTimeout
public void setReceiveTimeout(long receiveTimeout)
- Specify the timeout to use when receiving from the source (in milliseconds).
Note that this value will only be applicable if the source is an instance
of
BlockingSource
.
A negative value indicates that receive calls should block indefinitely.
The default value is 5000 (5 seconds).
setSendTimeout
public void setSendTimeout(long sendTimeout)
- Specify the timeout to use when sending to a target (in milliseconds).
Note that this value will only be applicable if the target is an instance
of
BlockingTarget
. The default value is 0.
setMaxMessagesPerTask
public void setMaxMessagesPerTask(int maxMessagesPerTask)
- Set the maximum number of messages to receive for each poll.
A non-positive value indicates that polling should repeat as long
as non-null messages are being received and successfully sent.
addTarget
public boolean addTarget(MessageTarget target)
removeTarget
public boolean removeTarget(MessageTarget target)
getSchedule
public Schedule getSchedule()
- Specified by:
getSchedule
in interface SchedulableTask
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
dispatch
private boolean dispatch()