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.

Reply via email to