public abstract class RoutePolicySupport extends ServiceSupport implements RoutePolicy
RoutePolicy
implementations.Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
Constructor and Description |
---|
RoutePolicySupport() |
Modifier and Type | Method and Description |
---|---|
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
ExceptionHandler |
getExceptionHandler() |
protected void |
handleException(Throwable t)
Handles the given exception using the
getExceptionHandler() |
void |
onExchangeBegin(Route route,
Exchange exchange)
|
void |
onExchangeDone(Route route,
Exchange exchange)
|
void |
onInit(Route route)
Callback invoked when the
Route is being initialized |
void |
onRemove(Route route)
Callback invoked when the
Route is being removed from CamelContext |
void |
onResume(Route route)
Callback invoked when the
Route is being resumed |
void |
onStart(Route route)
Callback invoked when the
Route is being started |
void |
onStop(Route route)
Callback invoked when the
Route is being stopped |
void |
onSuspend(Route route)
Callback invoked when the
Route is being suspended |
boolean |
resumeOrStartConsumer(Consumer consumer)
Resumes or starts the consumer.
|
void |
resumeRoute(Route route) |
void |
setExceptionHandler(ExceptionHandler exceptionHandler) |
boolean |
startConsumer(Consumer consumer)
Starts the consumer.
|
void |
startRoute(Route route) |
boolean |
stopConsumer(Consumer consumer)
Stops the consumer.
|
void |
stopRoute(Route route) |
void |
stopRoute(Route route,
long timeout,
TimeUnit timeUnit) |
void |
stopRouteAsync(Route route)
Allows to stop a route asynchronously using a separate background thread which can allow any current in-flight exchange
to complete while the route is being shutdown.
|
boolean |
suspendOrStopConsumer(Consumer consumer)
Suspends or stops the consumer.
|
void |
suspendRoute(Route route) |
void |
suspendRoute(Route route,
long timeout,
TimeUnit timeUnit) |
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
protected final org.slf4j.Logger log
public RoutePolicySupport()
public void onInit(Route route)
RoutePolicy
Route
is being initializedonInit
in interface RoutePolicy
route
- the route being initializedpublic void onRemove(Route route)
RoutePolicy
Route
is being removed from CamelContext
onRemove
in interface RoutePolicy
route
- the route being removedpublic void onStart(Route route)
RoutePolicy
Route
is being startedonStart
in interface RoutePolicy
route
- the route being startedpublic void onStop(Route route)
RoutePolicy
Route
is being stoppedonStop
in interface RoutePolicy
route
- the route being stoppedpublic void onSuspend(Route route)
RoutePolicy
Route
is being suspendedonSuspend
in interface RoutePolicy
route
- the route being suspendedpublic void onResume(Route route)
RoutePolicy
Route
is being resumedonResume
in interface RoutePolicy
route
- the route being resumedpublic void onExchangeBegin(Route route, Exchange exchange)
RoutePolicy
onExchangeBegin
in interface RoutePolicy
route
- the route where the exchange started fromexchange
- the created exchangepublic void onExchangeDone(Route route, Exchange exchange)
RoutePolicy
Exchange
is done being routed, where it started from the given Route
Notice this callback is invoked when the Exchange is done and the Route
is the route where
the Exchange
was started. Most often its also the route where the exchange is done. However its
possible to route an Exchange
to other routes using endpoints such as
direct or seda. Bottom line is that the Route
parameter may not be the endpoint
route and thus why we state its the starting route.onExchangeDone
in interface RoutePolicy
route
- the route where the exchange started fromexchange
- the created exchangepublic boolean startConsumer(Consumer consumer) throws Exception
Exception
resumeOrStartConsumer(Consumer)
public boolean stopConsumer(Consumer consumer) throws Exception
Exception
suspendOrStopConsumer(Consumer)
public boolean suspendOrStopConsumer(Consumer consumer) throws Exception
Suspendable
then the consumer is suspended,
otherwise the consumer is stopped.Exception
stopConsumer(Consumer)
public boolean resumeOrStartConsumer(Consumer consumer) throws Exception
Suspendable
then the consumer is resumed,
otherwise the consumer is started.Exception
startConsumer(Consumer)
public void startRoute(Route route) throws Exception
Exception
public void resumeRoute(Route route) throws Exception
Exception
public void suspendRoute(Route route) throws Exception
Exception
public void suspendRoute(Route route, long timeout, TimeUnit timeUnit) throws Exception
Exception
public void stopRoute(Route route) throws Exception
Exception
stopRouteAsync(Route)
public void stopRoute(Route route, long timeout, TimeUnit timeUnit) throws Exception
Exception
stopRouteAsync(Route)
public void stopRouteAsync(Route route)
protected void handleException(Throwable t)
getExceptionHandler()
t
- the exception to handleprotected void doStart() throws Exception
ServiceSupport
ServiceSupport.doStop()
for more details.doStart
in class ServiceSupport
Exception
ServiceSupport.doStop()
protected void doStop() throws Exception
ServiceSupport
ServiceSupport.doStop()
method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext
is shutting down.doStop
in class ServiceSupport
Exception
ServiceSupport.doStart()
public ExceptionHandler getExceptionHandler()
public void setExceptionHandler(ExceptionHandler exceptionHandler)
Apache Camel