Hello,

This is my setup, I am associating a routeId to the route and using this I
will be suspending/resuming/stopping the route on camelContext reference. 

String localRouteName = "ROUTE_LOCAL";
ExecutorService service ;

//Custom thread pool
ThreadPoolProfile customProfile = new ThreadPoolProfile("customProfile");
                customProfile.setPoolSize(threads);
                customProfile.setMaxPoolSize(threads);
        
camelContext.getExecutorServiceManager().registerThreadPoolProfile(customProfile);
                service = 
camelContext.getExecutorServiceManager().newThreadPool(this,
localRouteName, customProfile);

from(fileUrl).noAutoStartup().routeId(localRouteName)
           .threads()
          .bean(processManager)
          .bean(endRoute,localMethod).stop()
          .setExecutorService(service); 

e.g.
public void pause() {
                try {
                        for (String routeId : routesIds) {
                                ServiceStatus routeStatus = 
camelContext.getRouteStatus(routeId);
                                if (routeStatus.isStarted()) {
                                        camelContext.suspendRoute(routeId);
                                        logger.info("Route : "+routeId+" 
suspended");
                                } else if (routeStatus.isStopped()) {
                                        logger.info(true, 
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());
                }
        }

The problem I am facing is, though i am calling
camelContext.suspendRoute("ROUTE_LOCAL"), it is not suspending it. The
threads are picking the files one after the other. I want to know whether
there is any way in which the thread pool can be controlled..After all files
are processed, then it is suspending/resuming/stopping. 

Prior to concurrency introduction, it was running fine. 

Please guide me.

Thanks
Nafees




--
View this message in context: 
http://camel.465427.n5.nabble.com/Routes-controlling-thread-dsl-tp5719019p5719102.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to