To use controlbus you need to identify/name your route. Your from definition will look like this
from("quartz://myGroup/everyMinute?cron=0+0/1+*+*+*+? &stateful=true).routeId("stopThisRoute"). .to("stream:out")/ If you dont plan to use the controlbus, then in the current stopRoute method you can stop the route with following lines. context.stopRoute("stopThisRoute"); On Fri, Jun 5, 2015 at 11:02 PM, Andrew Block <andy.bl...@gmail.com> wrote: > Take a look at the Control Bus [1] which provides the functionality to > start/stop routes from another route. > > - Andy > > [1] - http://camel.apache.org/controlbus.html > > -- > Andrew Block > > > On June 5, 2015 at 11:41:24 AM, Akram (akram.s...@gmail.com) wrote: > > I am triggering the quartz cron scheduler in one route. The requirement is > to > stop/remove the scheduled quartz job from another route. I have tried the > below code but in vain. > //Quartz route > /from("quartz://myGroup/everyMinute?cron=0+0/1+*+*+*+?&stateful=true) > .to("stream:out")/ > > //Another route to stop the quartz scheduler > /from("restlet:/stopquartz?restletMethod=GET") > .beanRef("processor", "StopRoute") > .to("stream:out");/ > > //Stop Route method > /public void stopRoute(Exchange exchange) throws Exception { > CamelContext context = exchange.getContext(); > ServiceStatus status = > context.getRouteStatus(exchange.getIn().getHeader(ROUTE_NAME).toString()); > if (!(status == ServiceStatus.Stopped || status == > ServiceStatus.Stopping)) { > context.stopRoute(ROUTE_NAME); > > exchange.getOut().setBody(context.getRouteStatus(exchange.getIn().getHeader(ROUTE_NAME).toString())); > }else{ > exchange.getOut().setBody(ROUTE_NAME+" is already in stopped > state"); > > } > }/ > > Quartz route is not stopping and Scheduled job is still running. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Is-there-any-way-to-unschedule-the-Camel-quartz-job-tp5767916.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- - Ravi *[ View My Youtube Channel <https://www.youtube.com/playlist?list=PL5Y_TlNjh0D59A4K3yQQR7gNAslnxDmRB> ]* Phone: +91 *98 509 760 91*