I've put together a crude mechanism for starting/stopping routes by the name of their endpoint. I do agree however that adding/deleting is probably a nicer way of dealing with state.
I had to patch two classes in the Camel library. The EventdrivenConsumerRoute has to retain its consumer so that addServices (and hence ServicesForRoute) always returns the same answer. I need this to actually get at the registered consumer for a route. This patch may affect other portions of Camel that I am not yet aware of. The second one is related to state management within the ServiceSupport class. Here in the start method the states stopping and stopped are now explicitly set to false. IMO this reflects the intention more clearly anyway. Finding routes by name boils down to crude lookup. >From the context you can easily extract both a Map name -> uri and a map uri->route. Together they give you a mapping name -> route. I don't think there is an easier way right now. It was a long shot but shutting down a JmsEndpoint nicely shuts down all the processing (or so it seems). Restarting an endpoint required patching the ServiceSupport class. I've attached the code right here. http://www.nabble.com/file/p21743159/ContextEnricher.java ContextEnricher.java http://www.nabble.com/file/p21743159/ServiceSupport.java ServiceSupport.java http://www.nabble.com/file/p21743159/EventDrivenConsumerRoute.java EventDrivenConsumerRoute.java James.Strachan wrote: > > On 27/02/2008, Robert Thullner <[email protected]> wrote: >> >> >> >> James.Strachan wrote: >> > >> > >> > Adding new routes is supported today. The main thing missing right now >> > is to be able to easily stop/delete existing routes. >> > >> > >> > >> >> >> Can this just be done by writing a new Java class that contains the >> routes >> and then starting the class or is there some special procedure to >> achieve >> it? > > Whenever you like you can call > > camelContext.addRoutes(someRouteBuilder); > > we just don't have an easy way yet to stop routes derived from a route > builder > > -- > James > ------- > http://macstrac.blogspot.com/ > > Open Source Integration > http://open.iona.com > > -- View this message in context: http://www.nabble.com/Update-CamelContext-tp15678272s22882p21743159.html Sent from the Camel - Users mailing list archive at Nabble.com.
