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.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.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
|
doStart, getExceptionHandler, handleException, onExchangeBegin, onRemove, onResume, onStart, onStop, onSuspend, resumeOrStartConsumer, resumeRoute, setExceptionHandler, startConsumer, startRoute, stopConsumer, stopRoute, stopRoute, stopRouteAsync, suspendOrStopConsumer, suspendRoute, suspendRoute
doInit, doResume, doShutdown, doSuspend, getStatus, init, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public DurationRoutePolicy()
public DurationRoutePolicy(org.apache.camel.CamelContext camelContext, String routeId)
public org.apache.camel.CamelContext getCamelContext()
getCamelContext
in interface org.apache.camel.CamelContextAware
public void setCamelContext(org.apache.camel.CamelContext camelContext)
setCamelContext
in interface org.apache.camel.CamelContextAware
public int getMaxMessages()
public void setMaxMessages(int maxMessages)
public int getMaxSeconds()
public void setMaxSeconds(int maxSeconds)
public org.apache.camel.impl.DurationRoutePolicy.Action getAction()
public void setAction(org.apache.camel.impl.DurationRoutePolicy.Action action)
public void onInit(org.apache.camel.Route route)
onInit
in interface org.apache.camel.spi.RoutePolicy
onInit
in class org.apache.camel.support.RoutePolicySupport
public void onExchangeDone(org.apache.camel.Route route, org.apache.camel.Exchange exchange)
onExchangeDone
in interface org.apache.camel.spi.RoutePolicy
onExchangeDone
in class org.apache.camel.support.RoutePolicySupport
protected void doStop() throws Exception
doStop
in class org.apache.camel.support.RoutePolicySupport
Exception
protected void performMaxMessagesAction()
protected ScheduledFuture performMaxDurationAction()
Apache Camel