public abstract class DelayProcessorSupport extends DelegateAsyncProcessor
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
log |
processorshutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending| Constructor and Description |
|---|
DelayProcessorSupport(CamelContext camelContext,
Processor processor) |
DelayProcessorSupport(CamelContext camelContext,
Processor processor,
ScheduledExecutorService executorService,
boolean shutdownExecutorService) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract long |
calculateDelay(Exchange exchange) |
protected long |
currentSystemTime() |
protected void |
delay(long delay,
Exchange exchange)
Delays the given time before continuing.
|
protected void |
doShutdown()
Implementations override this method to perform customized shutdown.
|
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
int |
getDelayedCount()
Gets the current number of
Exchanges being delayed (hold back due throttle limit hit) |
protected void |
handleSleepInterruptedException(InterruptedException e,
Exchange exchange)
Called when a sleep is interrupted; allows derived classes to handle this case differently
|
boolean |
isAsyncDelayed() |
boolean |
isCallerRunsWhenRejected() |
boolean |
process(Exchange exchange,
AsyncCallback callback)
Processes the message exchange.
|
protected boolean |
processDelay(Exchange exchange,
AsyncCallback callback,
long delay) |
void |
setAsyncDelayed(boolean asyncDelayed) |
void |
setCallerRunsWhenRejected(boolean callerRunsWhenRejected) |
doStop, getProcessor, hasNext, next, process, processNext, setProcessor, setProcessor, toStringdoResume, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendpublic DelayProcessorSupport(CamelContext camelContext, Processor processor)
public DelayProcessorSupport(CamelContext camelContext, Processor processor, ScheduledExecutorService executorService, boolean shutdownExecutorService)
protected boolean processDelay(Exchange exchange, AsyncCallback callback, long delay)
public boolean process(Exchange exchange, AsyncCallback callback)
AsyncProcessorProcessor.process(org.apache.camel.Exchange), but the caller supports having the exchange asynchronously processed.
If there was a failure processing then the caused Exception would be set on the Exchange.process in interface AsyncProcessorprocess in class DelegateAsyncProcessorexchange - the message exchangecallback - the AsyncCallback will be invoked when the processing of the exchange is completed.
If the exchange is completed synchronously, then the callback is also invoked synchronously.
The callback should therefore be careful of starting recursive loop.public boolean isAsyncDelayed()
public void setAsyncDelayed(boolean asyncDelayed)
public boolean isCallerRunsWhenRejected()
public void setCallerRunsWhenRejected(boolean callerRunsWhenRejected)
protected abstract long calculateDelay(Exchange exchange)
public int getDelayedCount()
Exchanges being delayed (hold back due throttle limit hit)protected void delay(long delay,
Exchange exchange)
throws InterruptedException
delay - the delay time in millisexchange - the exchange being processedInterruptedExceptionprotected void handleSleepInterruptedException(InterruptedException e, Exchange exchange) throws InterruptedException
InterruptedExceptionprotected long currentSystemTime()
protected void doStart()
throws Exception
ServiceSupportServiceSupport.doStop() for more details.doStart in class DelegateAsyncProcessorExceptionServiceSupport.doStop()protected void doShutdown()
throws Exception
ServiceSupportdoShutdown in class ServiceSupportExceptionApache Camel