public abstract class ScheduledPollConsumer extends DefaultConsumer implements Runnable, org.apache.camel.Suspendable, org.apache.camel.PollingConsumerPollingStrategy, org.apache.camel.health.HealthCheckAware
Constructor and Description |
---|
ScheduledPollConsumer(org.apache.camel.Endpoint endpoint,
org.apache.camel.Processor processor) |
ScheduledPollConsumer(org.apache.camel.Endpoint endpoint,
org.apache.camel.Processor processor,
ScheduledExecutorService scheduledExecutorService) |
Modifier and Type | Method and Description |
---|---|
protected void |
addLastErrorDetail(String key,
Object value)
Adds a detail to the last caused error (exception) for the last poll that failed.
|
void |
afterPoll() |
long |
beforePoll(long timeout) |
protected void |
doBuild() |
protected void |
doInit() |
protected void |
doShutdown() |
protected void |
doStart() |
protected void |
doStop() |
protected void |
doSuspend() |
int |
getBackoffCounter() |
int |
getBackoffErrorThreshold() |
int |
getBackoffIdleThreshold() |
int |
getBackoffMultiplier() |
protected long |
getCounter()
Gets the total number of polls run.
|
long |
getDelay() |
protected long |
getErrorCounter()
Gets the error counter.
|
long |
getInitialDelay() |
protected Throwable |
getLastError()
Gets the last caused error (exception) for the last poll that failed.
|
protected Map<String,Object> |
getLastErrorDetails()
Gets the last caused error (exception) details for the last poll that failed.
|
org.apache.camel.spi.PollingConsumerPollStrategy |
getPollStrategy() |
long |
getRepeatCount() |
org.apache.camel.LoggingLevel |
getRunLoggingLevel() |
ScheduledExecutorService |
getScheduledExecutorService() |
org.apache.camel.spi.ScheduledPollConsumerScheduler |
getScheduler() |
Map<String,Object> |
getSchedulerProperties() |
protected long |
getSuccessCounter()
Gets the success counter.
|
TimeUnit |
getTimeUnit() |
protected boolean |
isFirstPoolDone()
Whether a first pool attempt has been done (also if the consumer has been restarted)
|
boolean |
isGreedy() |
protected boolean |
isPollAllowed() |
boolean |
isPolling()
Whether polling is currently in progress
|
boolean |
isSchedulerStarted() |
boolean |
isSendEmptyMessageWhenIdle() |
boolean |
isStartScheduler() |
boolean |
isUseFixedDelay() |
void |
onInit() |
protected abstract int |
poll()
The polling method which is invoked periodically to poll this consumer
|
protected void |
processEmptyMessage()
No messages to poll so send an empty message instead.
|
void |
run()
Invoked whenever we should be polled
|
void |
setBackoffErrorThreshold(int backoffErrorThreshold) |
void |
setBackoffIdleThreshold(int backoffIdleThreshold) |
void |
setBackoffMultiplier(int backoffMultiplier) |
void |
setDelay(long delay) |
void |
setGreedy(boolean greedy) |
void |
setInitialDelay(long initialDelay) |
void |
setPollStrategy(org.apache.camel.spi.PollingConsumerPollStrategy pollStrategy) |
void |
setRepeatCount(long repeatCount) |
void |
setRunLoggingLevel(org.apache.camel.LoggingLevel runLoggingLevel) |
void |
setScheduledExecutorService(ScheduledExecutorService scheduledExecutorService) |
void |
setScheduler(org.apache.camel.spi.ScheduledPollConsumerScheduler scheduler) |
void |
setSchedulerProperties(Map<String,Object> schedulerProperties) |
void |
setSendEmptyMessageWhenIdle(boolean sendEmptyMessageWhenIdle) |
void |
setStartScheduler(boolean startScheduler) |
void |
setTimeUnit(TimeUnit timeUnit) |
void |
setUseFixedDelay(boolean useFixedDelay) |
void |
startScheduler()
Starts the scheduler.
|
createExchange, createUoW, defaultConsumerCallback, doneUoW, getAsyncProcessor, getEndpoint, getExceptionHandler, getHealthCheck, getProcessor, getRoute, getRouteId, handleException, handleException, releaseExchange, setExceptionHandler, setHealthCheck, setRoute, setRouteId, toString
build, doFail, doLifecycleChange, doResume, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getHealthCheck, setHealthCheck
public ScheduledPollConsumer(org.apache.camel.Endpoint endpoint, org.apache.camel.Processor processor)
public ScheduledPollConsumer(org.apache.camel.Endpoint endpoint, org.apache.camel.Processor processor, ScheduledExecutorService scheduledExecutorService)
protected void processEmptyMessage() throws Exception
Exception
- is thrown if error processing the empty message.protected boolean isPollAllowed()
public boolean isPolling()
public org.apache.camel.spi.ScheduledPollConsumerScheduler getScheduler()
public void setScheduler(org.apache.camel.spi.ScheduledPollConsumerScheduler scheduler)
public long getInitialDelay()
public void setInitialDelay(long initialDelay)
public long getDelay()
public void setDelay(long delay)
public TimeUnit getTimeUnit()
public void setTimeUnit(TimeUnit timeUnit)
public boolean isUseFixedDelay()
public void setUseFixedDelay(boolean useFixedDelay)
public org.apache.camel.LoggingLevel getRunLoggingLevel()
public void setRunLoggingLevel(org.apache.camel.LoggingLevel runLoggingLevel)
public org.apache.camel.spi.PollingConsumerPollStrategy getPollStrategy()
public void setPollStrategy(org.apache.camel.spi.PollingConsumerPollStrategy pollStrategy)
public boolean isStartScheduler()
public void setStartScheduler(boolean startScheduler)
public void setSendEmptyMessageWhenIdle(boolean sendEmptyMessageWhenIdle)
public boolean isSendEmptyMessageWhenIdle()
public boolean isGreedy()
public void setGreedy(boolean greedy)
public int getBackoffCounter()
public int getBackoffMultiplier()
public void setBackoffMultiplier(int backoffMultiplier)
public int getBackoffIdleThreshold()
public void setBackoffIdleThreshold(int backoffIdleThreshold)
public int getBackoffErrorThreshold()
public void setBackoffErrorThreshold(int backoffErrorThreshold)
public long getRepeatCount()
public void setRepeatCount(long repeatCount)
public ScheduledExecutorService getScheduledExecutorService()
public boolean isSchedulerStarted()
public void setScheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
protected long getErrorCounter()
getSuccessCounter()
protected long getSuccessCounter()
getErrorCounter()
protected long getCounter()
protected boolean isFirstPoolDone()
protected Throwable getLastError()
protected Map<String,Object> getLastErrorDetails()
HealthCheck.HTTP_RESPONSE_CODE
can be included.protected void addLastErrorDetail(String key, Object value)
HealthCheck.HTTP_RESPONSE_CODE
can be included.key
- the key (see HealthCheck
)value
- the valueprotected abstract int poll() throws Exception
Exception
- can be thrown if an exception occurred during pollingprotected void doBuild() throws Exception
doBuild
in class DefaultConsumer
Exception
protected void doInit() throws Exception
doInit
in class DefaultConsumer
Exception
protected void doStart() throws Exception
doStart
in class DefaultConsumer
Exception
public void startScheduler()
protected void doStop() throws Exception
doStop
in class DefaultConsumer
Exception
protected void doShutdown() throws Exception
doShutdown
in class DefaultConsumer
Exception
protected void doSuspend() throws Exception
doSuspend
in class org.apache.camel.support.service.BaseService
Exception
public void onInit() throws Exception
onInit
in interface org.apache.camel.PollingConsumerPollingStrategy
Exception
public long beforePoll(long timeout) throws Exception
beforePoll
in interface org.apache.camel.PollingConsumerPollingStrategy
Exception
Apache Camel