camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Wolf <cwolf.a...@gmail.com>
Subject Question about the implementation of routepolicy.quartz.ScheduledRoutePolicy
Date Mon, 25 Mar 2013 20:08:23 GMT
I am looking at code in
org.apache.camel.routepolicy.quartz.ScheduledRoutePolicy -
the code that starts/stops/resumes/suspends the route it is a policy for.

The question is why is it separately acting on the Consumer? I thought
if you call
CamelContext.suspendRoute(route)  and/or CamelContext.resumeRoute(route),
that all the components in the route are suspended/resumed as well?

Secondly, why does this code assume there is a Consumer?  What if the route has
a Producer?

I am not being critical - I just want to understand, generally how
route suspend/resume works
since I am implementing a similar RoutePolicy.

Thanks,


   -Chris


 protected void onJobExecute(Action action, Route route) throws Exception {
[...]
        } else if (action == Action.SUSPEND) {
            if (routeStatus == ServiceStatus.Started) {
                stopConsumer(route.getConsumer());
            } else {
                LOG.warn("Route is not in a started state and cannot
be suspended. The current route state is {}", routeStatus);
            }
        } else if (action == Action.RESUME) {
            if (routeStatus == ServiceStatus.Started) {
                if (ServiceHelper.isSuspended(route.getConsumer())) {
                    startConsumer(route.getConsumer());
                } else {
                    LOG.warn("The Consumer {} is not suspended and
cannot be resumed.", route.getConsumer());
                }

[...]

Mime
View raw message