|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.camel.impl.ServiceSupport
org.apache.camel.impl.DefaultConsumer
org.apache.camel.impl.ScheduledPollConsumer
public abstract class ScheduledPollConsumer
A useful base class for any consumer which is polling based
| Field Summary |
|---|
| Fields inherited from class org.apache.camel.impl.DefaultConsumer |
|---|
log |
| Constructor Summary | |
|---|---|
ScheduledPollConsumer(Endpoint endpoint,
Processor processor)
|
|
ScheduledPollConsumer(Endpoint endpoint,
Processor processor,
ScheduledExecutorService executor)
|
|
| Method Summary | |
|---|---|
void |
afterPoll()
Callback invoked after the poll. |
void |
beforePoll()
Callback invoked before the poll. |
protected void |
doStart()
|
protected void |
doStop()
|
protected void |
doSuspend()
Implementations override this method to support customized suspend/resume. |
long |
getDelay()
|
long |
getInitialDelay()
|
PollingConsumerPollStrategy |
getPollStrategy()
|
LoggingLevel |
getRunLoggingLevel()
|
TimeUnit |
getTimeUnit()
|
protected boolean |
isPollAllowed()
|
boolean |
isUseFixedDelay()
|
void |
onInit()
Callback invoked when the consumer is initialized such as when the PollingConsumer starts. |
protected abstract int |
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 |
setRunLoggingLevel(LoggingLevel runLoggingLevel)
|
void |
setTimeUnit(TimeUnit timeUnit)
Sets the time unit to use. |
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 |
|---|
public ScheduledPollConsumer(Endpoint endpoint,
Processor processor)
public ScheduledPollConsumer(Endpoint endpoint,
Processor processor,
ScheduledExecutorService executor)
| Method Detail |
|---|
public void run()
run in interface Runnableprotected boolean isPollAllowed()
public long getInitialDelay()
public void setInitialDelay(long initialDelay)
public long getDelay()
public void setDelay(long delay)
public TimeUnit getTimeUnit()
public void setTimeUnit(TimeUnit timeUnit)
getDelay() and getInitialDelay() are using
the same time unit. So if you change this value, then take into account that the
default value of getInitialDelay() is 1000. So you may to adjust this value accordingly.
timeUnit - the time unit.public boolean isUseFixedDelay()
public void setUseFixedDelay(boolean useFixedDelay)
public LoggingLevel getRunLoggingLevel()
public void setRunLoggingLevel(LoggingLevel runLoggingLevel)
public PollingConsumerPollStrategy getPollStrategy()
public void setPollStrategy(PollingConsumerPollStrategy pollStrategy)
protected abstract int poll()
throws Exception
Exception - can be thrown if an exception occurred during polling
protected void doStart()
throws Exception
doStart in class DefaultConsumerException
protected void doStop()
throws Exception
doStop in class DefaultConsumerException
protected void doSuspend()
throws Exception
ServiceSupport
doSuspend in class ServiceSupportException
public void onInit()
throws Exception
PollingConsumerPollingStrategyPollingConsumer starts.
onInit in interface PollingConsumerPollingStrategyException - can be thrown if error initializing.
public void beforePoll()
throws Exception
PollingConsumerPollingStrategy
beforePoll in interface PollingConsumerPollingStrategyException - can be thrown if error occurred
public void afterPoll()
throws Exception
PollingConsumerPollingStrategy
afterPoll in interface PollingConsumerPollingStrategyException - can be thrown if error occurred
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||