FAQ
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.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 8 | next ›
Discussion Overview
groupusers @
categoriescamel
postedSep 10, '12 at 10:15a
activeSep 12, '12 at 6:45a
posts8
users2
websitecamel.apache.org

2 users in discussion

Nafees: 4 posts Claus Ibsen: 4 posts

People

Translate

site design / logo © 2022 Grokbase