The FTP client library do not support concurrency, so you cannot
download multiple FTP files at the same time.

Read the red box at its documentation page
http://camel.apache.org/ftp2


On Mon, Sep 10, 2012 at 12:08 PM, Nafees <[email protected]> wrote:
> 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
> ExecutorServiceManager
>
> ExecutorService service ;
>
> ThreadPoolProfile customProfile = new ThreadPoolProfile("customProfile");
>                 customProfile.setPoolSize(5);
>                 customProfile.setMaxPoolSize(5);
>
> 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);
>
> later when route is completed , i am calling this to remove the threads.
>             camelContext.getExecutorServiceManager().shutdown(service);
>
> 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);
>                                         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());
>                 }
>         }// 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
> Nafees
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Routes-controlling-thread-dsl-tp5719019.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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

Reply via email to