camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: context.stopRoute() API hangs periodically
Date Thu, 07 Jan 2010 07:57:18 GMT
Hi,

Can you check if there are deadlock of CamelContext which introduce this 
error?
Did you use the camelContext as the monitor Object when you try to stop 
the Route ?

Willem

boday wrote:
> I'm using Camel 2.1 on SMX 3.3.1.  I'm using a timer to periodically
> reprocess messages that I've sent to an error queue.  While reprocessing I
> want to stop the main message processing route as follows (for some specific
> client requirements)...
> 
> from("direct:main").routeId("mainRoute").process(MessageProcessor());
> 
> from("timer://ErrorMessageProcessor?period=60000")
> .bean(blockedNodeManager, "processBlockedQueue");
> 
> then, in blockedNodeManager stops the route, acts as a polling consumer and
> then restarts the route...
> 
> ServiceStatus routeStatus = context.getRouteStatus("mainRoute");
> if(routeStatus.isStoppable())
> {
> 	logger.info("stopping route..." + routeId);
> 	context.stopRoute(routeId);
> 	logger.info("route stopped..." + routeId);
> }
> 
> while (true) 
> {
>     String msg = consumer.receiveBody("activemq:errorQueue", 100,
> String.class);
>     if (msg == null)
>     {
> 	break;
>     }
>     producer.sendBody("direct:main", msg);    
> }
> 
> routeStatus = context.getRouteStatus("mainRoute");
> if(routeStatus.isStartable())
> {
>     logger.info("starting route..." + routeId);
>     context.startRoute(routeId);
>     logger.info("route started..." + routeId);
> }
> 
> This seems to work fine for a while (up to 12 hours sometimes), but will
> periodically hang while trying to stop the main route.  The last message I
> see in my log file is...."stopping route mainRoute"...it never reaches the
> "route stopped" debug statement.  At this point, I'm hosed...I can't even
> use JMX to restart the route.  I restart the server and all works fine again
> (for a while)...
> 
> Am I using these APIs incorrectly?  If there is a better way to accomplish
> this, let me know...
> 
> thanks in advance...
> 
> 
> 
> 
> -----
> Ben - Senior Consultant
> using SMX 3.3.1/Camel 2.1


Mime
View raw message