camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boday <bo...@vektrel.com>
Subject start/stop routes programmatically
Date Tue, 15 Dec 2009 01:15:46 GMT

I see that Camel 2.1 now support starting/stopping routes via JMX/APIs.  But,
how do I identify routes properly at runtime...

For example, assume I have the following route...

from("activemq:queue1").to("activemq:queue2");
from("activemq:queue2").to("activemq:queue3");

They show up in JMX as "route1" and "route2".  The description/endpointURI
fields definitely help, but might be problematic to use when there are a lot
of routes.  

The same applies to finding a routes with Camel APIs.  I can get a list of
routes using this...

getContext().getRouteCollection().getRoutes()

I see that I can then call the following on a RouteDefinition to get to the
first endpoint name

routeDefinition.getInputs().get(0).getLabel()

I guess I could use this name to identify a route and then call
stop()/start() on it...but this seems like a very indirect approach to
identify it?  Am I missing something?

What I'd like to do is give a route an explicit name that can be referenced
later (in JMX/programmatically)...maybe the DescriptionDefinition class
could help, but am not sure how to use it...

something along these lines is what I'm looking for...

setRouteName("InboundRoute").from("activemq:queue1").to("activemq:queue2");
setRouteName("ProcessingRoute").from("activemq:queue2").to("activemq:queue3");

thanks in advance...






-----
Ben - Senior Consultant
using SMX 3.3.1/Camel 2.0
-- 
View this message in context: http://old.nabble.com/start-stop-routes-programmatically-tp26781725p26781725.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message