public class DurationRoutePolicy
extends org.apache.camel.support.RoutePolicySupport
implements org.apache.camel.CamelContextAware
RoutePolicy which executes for a duration and then triggers an action.
This can be used to stop the route after it has processed a number of messages, or has been running for N seconds.| Constructor and Description |
|---|
DurationRoutePolicy() |
DurationRoutePolicy(org.apache.camel.CamelContext camelContext,
String routeId) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doStop() |
org.apache.camel.impl.engine.DurationRoutePolicy.Action |
getAction() |
org.apache.camel.CamelContext |
getCamelContext() |
int |
getMaxMessages() |
int |
getMaxSeconds() |
void |
onExchangeDone(org.apache.camel.Route route,
org.apache.camel.Exchange exchange) |
void |
onInit(org.apache.camel.Route route) |
protected ScheduledFuture |
performMaxDurationAction() |
protected void |
performMaxMessagesAction() |
void |
setAction(org.apache.camel.impl.engine.DurationRoutePolicy.Action action)
What action to perform when maximum is triggered.
|
void |
setCamelContext(org.apache.camel.CamelContext camelContext) |
void |
setMaxMessages(int maxMessages)
Maximum number of messages to process before the action is triggered
|
void |
setMaxSeconds(int maxSeconds)
Maximum seconds Camel is running before the action is triggered
|
controller, doStart, getExceptionHandler, handleException, onExchangeBegin, onRemove, onResume, onStart, onStop, onSuspend, resumeOrStartConsumer, resumeRoute, setExceptionHandler, startConsumer, startRoute, stopConsumer, stopRoute, stopRoute, stopRouteAsync, suspendOrStopConsumer, suspendRoute, suspendRoutebuild, doBuild, doInit, doResume, doShutdown, doSuspend, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendpublic DurationRoutePolicy()
public DurationRoutePolicy(org.apache.camel.CamelContext camelContext,
String routeId)
public org.apache.camel.CamelContext getCamelContext()
getCamelContext in interface org.apache.camel.CamelContextAwarepublic void setCamelContext(org.apache.camel.CamelContext camelContext)
setCamelContext in interface org.apache.camel.CamelContextAwarepublic int getMaxMessages()
public void setMaxMessages(int maxMessages)
public int getMaxSeconds()
public void setMaxSeconds(int maxSeconds)
public org.apache.camel.impl.engine.DurationRoutePolicy.Action getAction()
public void setAction(org.apache.camel.impl.engine.DurationRoutePolicy.Action action)
public void onInit(org.apache.camel.Route route)
onInit in interface org.apache.camel.spi.RoutePolicyonInit in class org.apache.camel.support.RoutePolicySupportpublic void onExchangeDone(org.apache.camel.Route route,
org.apache.camel.Exchange exchange)
onExchangeDone in interface org.apache.camel.spi.RoutePolicyonExchangeDone in class org.apache.camel.support.RoutePolicySupportprotected void doStop()
throws Exception
doStop in class org.apache.camel.support.RoutePolicySupportExceptionprotected void performMaxMessagesAction()
protected ScheduledFuture performMaxDurationAction()
Apache Camel