Hi ste, Thank you for the response.
I'm developing a system where routes destination endpoint can be added/updated/removed dynamically. A received XML message specifies the operation, a route identifier name and the route destination endpoint address. After this, the camel route from the camel context is updated/removed. The routes are also present in a database, which have its routes added/updated/removed from. That's why I need to remove or update the route. Adding is pretty easy, but for updating/removing I need to first find the route using the previously specified address. I've tried something like the code below, which is not working (the route is not being updated for some reason. I'm using the setURI() method): [CODE] List<RouteDefinition> routes = camelContext.getRouteDefinitions(); // Searches for the route to be updated for( int i = 0 ; i < routes.size() ; i++ ) { RouteDefinition routeToUpdate = routes.get(i); /* * Look for the correct route to update. * The route to be updated is * [FROM=activemq:queue:out_<routeId>] -> [TO:<newRouteDestination>] */ // Look for the route that starts with : [FROM=activemq:queue:out_<routeId>] if ( SearchUtil.find( ((FromDefinition) routeToUpdate.getInputs().get(0)).getLabel() , "out_" + newCommunicationRoute.getId() ) == true ) { // Found! Update the destination. First stops the route, update it, then restarts it camelContext.stopRoute( routeToUpdate ); // Update destination [TO:<newRouteDestination>] ((SendDefinition<ProcessorDefinition>) routeToUpdate.getOutputs().get(0)).setUri( newConfiguration.getTransp() + newConfiguration.getParam()); // restart it camelContext.startRoute( routeToUpdate ); [/CODE] Strangely, the printed result of (SendDefinition<ProcessorDefinition>) routeToUpdate.getOutputs().get(0) is differente from ((SendDefinition<ProcessorDefinition>) routeToUpdate.getOutputs().get(0)) .getUri() . The getUri() returns something that seems not to be used, and the route is not updated. About the route removal, I didn't tried yet. Thank you, Ricardo On Thu, Jan 28, 2010 at 6:32 PM, Stephen Gargan <steve.gar...@gmail.com>wrote: > Ricardo, > > What are you trying to do? Are you trying to programmatically stop a > route from processing by removing it? If so try specifying a > RoutePolicy instead. If you can explain your intention a little more > we can definitely suggest options. > > rgds, > > ste > > On Thu, Jan 28, 2010 at 10:37 AM, Ricardo Melo <rica...@cflex.com.br> > wrote: > > Hi, > > > > I'm new to camel API and I need to update or remove camel routes that > have > > been created. > > > > I've found in an example that to find current routes, I need to use the > > code: > > List<RouteDefinition> routes = camelContext.getRouteDefinitions(); > > > > I can iterate through the routes definition, however how can I see the > "to" > > (destination) endpoint of a route definition, to update or remove the > route > > I'm looking for? Where is it? > > > > Thanks in advance! > > -- > > Ricardo Britto Melo > > > > CFlex - Empower your Decisions > > Tel: (+55 19) 3251-5211 > > Rua Barão de Paranapanema, 401A > > Campinas - SP > > www.cflex.com.br > > > -- Ricardo Britto Melo CFlex - Empower your Decisions Tel: (+55 19) 3251-5211 Rua Barão de Paranapanema, 401A Campinas - SP www.cflex.com.br