Hi,
Finally, I used my own LifecycleStrategy implementation to persist the routes in xml files (onRoutesAdd,onRoutesRemove,onContextStart) . For the route loading in the context I follow the link. And for the marshalling i took example inside the ModelHelper.dumpModelAsXml for the jaxb marshalling. And now it works like a charm. I'm just a little bit affraid by the deprecated methods: CamelContext.loadRoutesDefinition and CamelContext.addRouteDefinitions. :) Thank you for the help. 2012/1/19 Claus Ibsen <[email protected]> > Hi > > Just marshal the routes to XML *before* you add new routes dynamic. > > > On Thu, Jan 19, 2012 at 3:59 PM, Nicolas Gapaillard > <[email protected]> wrote: > > Hi, > > > > Thank you for your answer, > > > > I'm not sure it is really adapted to my problem. > > > > Because I need to export automatically, not manually. I want that my > camel > > server has always the last routes. For example, if my camel server > crashes, > > I want to keep all the routes created before the crashe. > > > > Or maybe I can use your solution plugged on a new implementation of a > camel > > lifecycleStrategy: > > > > - Export for each route creation/deletion using my own camel > > LifecycleStrategy implementation. > > - And load all routes during the camel context startup. > > > > It means that performance will be slower => it is necessary to marshall > the > > xml for each route creation/deletion (ok it is not so critical in my > case I > > think). > > > > But it seems to me a complex solution for a problem that looks simple. > > > > If someone has an other way to investigate or say me that there isn't > > another solution, don't hesitate. > > > > Thank you. > > > > > > > > > > > > > > > > > > > > > > > > 2012/1/19 Claus Ibsen <[email protected]> > > > >> Hi > >> > >> Yeah can export the routes as XML, and then load them upon restart. > >> > >> A little example to load the routes > >> http://camel.apache.org/loading-routes-from-xml-files.html > >> > >> Then to save them is also fairly easy. > >> > >> > >> > >> On Thu, Jan 19, 2012 at 1:55 PM, Nicolas Gapaillard > >> <[email protected]> wrote: > >> > Hi all, > >> > > >> > Is is something in camel that permits to persist the routes created > >> > dynamically in bdd or an xml file ? > >> > > >> > Because for now, I have an application that permits to instanciate new > >> > routes inside camel via the RoutesBuilder. It works very well. But if > >> camel > >> > is restarted, I lose all my already defined routes. > >> > > >> > I searched inside the documentation and I didn't see anything about > that. > >> > > >> > For info, I use the 2.9.0 version of apache camel. > >> > > >> > If someone has an idea. > >> > > >> > Thank you. > >> > > >> > > >> > > >> > -- > >> > Nicolas Gapaillard > >> > [email protected] > >> > >> > >> > >> -- > >> Claus Ibsen > >> ----------------- > >> FuseSource > >> Email: [email protected] > >> Web: http://fusesource.com > >> Twitter: davsclaus, fusenews > >> Blog: http://davsclaus.blogspot.com/ > >> Author of Camel in Action: http://www.manning.com/ibsen/ > >> > > > > > > > > -- > > Nicolas Gapaillard > > [email protected] > > > > -- > Claus Ibsen > ----------------- > FuseSource > Email: [email protected] > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ > -- Nicolas Gapaillard [email protected]
