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: context.stopRoute() API hangs periodically
Date Thu, 07 Jan 2010 08:06:37 GMT
On Thu, Jan 7, 2010 at 8:57 AM, Willem Jiang <willem.jiang@gmail.com> wrote:
> 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 ?
>

Yeah try to dump the thread stack list and see where the stopping is waiting.

BTW: In Camel 2.2 you can now suspend a route which is more gentle.


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



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message