org.apache.camel.impl
Class ScheduledPollConsumer

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.impl.DefaultConsumer
          extended by org.apache.camel.impl.ScheduledPollConsumer
All Implemented Interfaces:
Runnable, Consumer, Service, ShutdownableService, SuspendableService
Direct Known Subclasses:
DefaultScheduledPollConsumer, FeedPollingConsumer, GenericFileConsumer, IBatisPollingConsumer, JpaConsumer, MailConsumer, SnmpOIDPoller

public abstract class ScheduledPollConsumer
extends DefaultConsumer
implements Runnable, SuspendableService

A useful base class for any consumer which is polling based

Version:
$Revision: 21668 $

Field Summary
 
Fields inherited from class org.apache.camel.impl.DefaultConsumer
log
 
Constructor Summary
ScheduledPollConsumer(DefaultEndpoint endpoint, Processor processor)
           
ScheduledPollConsumer(Endpoint endpoint, Processor processor, ScheduledExecutorService executor)
           
 
Method Summary
protected  void doStart()
           
protected  void doStop()
           
protected  void doSuspend()
          Implementations override this method to support customized suspend/resume.
 long getDelay()
           
 long getInitialDelay()
           
 PollingConsumerPollStrategy getPollStrategy()
           
 TimeUnit getTimeUnit()
           
protected  boolean isPollAllowed()
           
 boolean isUseFixedDelay()
           
protected abstract  void poll()
          The polling method which is invoked periodically to poll this consumer
 void run()
          Invoked whenever we should be polled
 void setDelay(long delay)
           
 void setInitialDelay(long initialDelay)
           
 void setPollStrategy(PollingConsumerPollStrategy pollStrategy)
           
 void setTimeUnit(TimeUnit timeUnit)
           
 void setUseFixedDelay(boolean useFixedDelay)
           
 
Methods inherited from class org.apache.camel.impl.DefaultConsumer
getAsyncProcessor, getEndpoint, getExceptionHandler, getProcessor, handleException, setExceptionHandler, toString
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, doResume, doShutdown, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, removeChildService, resume, shutdown, start, start, stop, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
 
Methods inherited from interface org.apache.camel.Service
start, stop
 

Constructor Detail

ScheduledPollConsumer

public ScheduledPollConsumer(DefaultEndpoint endpoint,
                             Processor processor)

ScheduledPollConsumer

public ScheduledPollConsumer(Endpoint endpoint,
                             Processor processor,
                             ScheduledExecutorService executor)
Method Detail

run

public void run()
Invoked whenever we should be polled

Specified by:
run in interface Runnable

isPollAllowed

protected boolean isPollAllowed()

getInitialDelay

public long getInitialDelay()

setInitialDelay

public void setInitialDelay(long initialDelay)

getDelay

public long getDelay()

setDelay

public void setDelay(long delay)

getTimeUnit

public TimeUnit getTimeUnit()

setTimeUnit

public void setTimeUnit(TimeUnit timeUnit)

isUseFixedDelay

public boolean isUseFixedDelay()

setUseFixedDelay

public void setUseFixedDelay(boolean useFixedDelay)

getPollStrategy

public PollingConsumerPollStrategy getPollStrategy()

setPollStrategy

public void setPollStrategy(PollingConsumerPollStrategy pollStrategy)

poll

protected abstract void poll()
                      throws Exception
The polling method which is invoked periodically to poll this consumer

Throws:
Exception - can be thrown if an exception occurred during polling

doStart

protected void doStart()
                throws Exception
Overrides:
doStart in class DefaultConsumer
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Overrides:
doStop in class DefaultConsumer
Throws:
Exception

doSuspend

protected void doSuspend()
                  throws Exception
Description copied from class: ServiceSupport
Implementations override this method to support customized suspend/resume.

Overrides:
doSuspend in class ServiceSupport
Throws:
Exception


Apache CAMEL