camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Routes controlling + thread dsl
Date Tue, 11 Sep 2012 10:14:24 GMT
You need to set the max queue of the pool to 0 if you dont want any
backlog on the thread pool.


On Tue, Sep 11, 2012 at 12:03 PM, Nafees <s.nafeesunnisa@gmail.com> wrote:
> 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.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message