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: start/stop routes programmatically
Date Tue, 15 Dec 2009 02:51:18 GMT
If you are using camel 2.0, you may need to use id() dsl,
but for camel 2.1 you can use the routeId() dsl.

You can find more information here[1]

[1] https://issues.apache.org/activemq/browse/CAMEL-2109

Willem

Willem Jiang wrote:
> Hi Jon,
> 
> After checking the code, I think the DSL should be
> from("activemq:queue1").routeId("InboundRoute").to("activemq:queue2");
> from("activemq:queue2").routeId("ProcessingRoute").to("activemq:queue3");
> 
> Willem
> 
> Jon Anstey wrote:
>> You can set custom ids for each route like this:
>>
>> from("activemq:queue1").id("InboundRoute").to("activemq:queue2");
>> from("activemq:queue2").id("ProcessingRoute").to("activemq:queue3");
>>
>> in the Spring DSL you can just use standard id attributes like:
>>
>> ...
>> <route id="InboundRoute">
>> ...
>>
>> On Mon, Dec 14, 2009 at 9:45 PM, boday <boday@vektrel.com> wrote:
>>
>>> 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