public abstract class AbstractPollingMessageReceiver extends AbstractMessageReceiver
AbstractPollingMessageReceiver
implements a base class for polling
message receivers. The receiver provides a poll()
method that implementations
must implement to execute their custom code. Note that the receiver will not poll if
the associated connector is not started.Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_POLL_FREQUENCY |
static TimeUnit |
DEFAULT_POLL_TIMEUNIT |
static long |
DEFAULT_STARTUP_DELAY |
protected List |
schedules |
connected, connecting, connectionStrategy, connector, disposing, endpoint, logger, receiverKey, responseEndpoint, service, stopped
PHASE_NAME
PHASE_NAME
PHASE_NAME
PHASE_NAME
Constructor and Description |
---|
AbstractPollingMessageReceiver(Connector connector,
Service service,
InboundEndpoint endpoint) |
Modifier and Type | Method and Description |
---|---|
protected PollingReceiverWorker |
createWork() |
protected void |
doStart() |
protected void |
doStop() |
long |
getFrequency() |
TimeUnit |
getTimeUnit() |
abstract void |
poll() |
protected void |
schedule()
This method registers this receiver for periodic polling ticks with the connectors
scheduler.
|
void |
setFrequency(long value) |
void |
setTimeUnit(TimeUnit timeUnit) |
protected void |
unschedule()
This method cancels the schedules which were created in
schedule() . |
connect, disconnect, dispose, doConnect, doDisconnect, doDispose, doInitialise, getConnectEventId, getConnectionDescription, getConnector, getEndpoint, getEndpointURI, getListener, getReceiverKey, getService, getWorkManager, handleException, handleUnacceptedFilter, initialise, isConnected, routeMessage, routeMessage, routeMessage, routeMessage, routeMessage, routeMessage, setConnector, setEndpoint, setExceptionDetails, setListener, setReceiverKey, setService, setWorkManager, start, stop, toString
public static final long DEFAULT_POLL_FREQUENCY
public static final TimeUnit DEFAULT_POLL_TIMEUNIT
public static final long DEFAULT_STARTUP_DELAY
protected final List schedules
public AbstractPollingMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException
CreateException
protected void doStart() throws MuleException
doStart
in class AbstractMessageReceiver
MuleException
protected void doStop() throws MuleException
doStop
in class AbstractMessageReceiver
MuleException
protected void schedule() throws RejectedExecutionException, NullPointerException, IllegalArgumentException
RejectedExecutionException
NullPointerException
IllegalArgumentException
ScheduledExecutorService#scheduleWithFixedDelay(Runnable, long, long, TimeUnit)}
protected void unschedule()
schedule()
.Future#cancel(boolean)}
protected PollingReceiverWorker createWork()
public long getFrequency()
public void setFrequency(long value)
public TimeUnit getTimeUnit()
public void setTimeUnit(TimeUnit timeUnit)
Copyright © 2003–2013 MuleSource, Inc.. All rights reserved.