camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Block <andy.bl...@gmail.com>
Subject Re: Is there any way to unschedule the Camel quartz job
Date Fri, 05 Jun 2015 17:32:54 GMT
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.sa18@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.  

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message