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
--
View this message in context:
http://old.nabble.com/context.stopRoute%28%29-API-hangs-periodically-tp27026922p27026922.html
Sent from the Camel - Users mailing list archive at Nabble.com.