camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nafees <>
Subject Routes controlling + thread dsl
Date Mon, 10 Sep 2012 10:08:45 GMT
Hello All,

I am using thread dsl to implement parallel processing in my route.

I have one ROUTE_FTP --  from (ftp).to(fileUrl).bean(endRoute);

I want to use thread dsl .. so that threads pick up files n do processing
simultaneously. With camel , it was so easy to do this.

I created a ThreadPoolProfile whose size is 5 and registered with

ExecutorService service ;

ThreadPoolProfile customProfile = new ThreadPoolProfile("customProfile");
		service = camelContext.getExecutorServiceManager().newThreadPool(this,
localRouteName, customProfile);


later when route is completed , i am calling this to remove the threads.

Everything is working perfectly. I would like to learn how better we could
make this.

Only concern i have is .. ROUTE_FTP and ROUTE_LOCAL can be given commands to
suspend, resume and cancel. 

when my action is suspend/resume/cancel , camel is unable to do the action.
How to achieve this. I want the threads also to be suspended/resumed/cancel
along with my route. 

sample pause function 
public void pause() {
		try {
			for (String routeId : routesIds) {
				ServiceStatus routeStatus = camelContext.getRouteStatus(routeId);
				if (routeStatus.isStarted()) {
					camelContext.suspendRoute(routeId);"Route : "+routeId+" suspended");
				} else if (routeStatus.isStopped()) {, tubeMessage.getSourceName(), "Route : " + routeId + "
is stopped , so cant pause");
		} catch (Exception e) {
			logger.error(true, tubeMessage.getSourceName(), "Problem while pausing
the mediation process " + e.getMessage());
	}// pause

What things should be done in order to do this. Earlier , without threads(),
suspend/resume/cancel were working fine. 

Please help me

Thanks & Regards

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message