I did something similar, maybe not the best, in an OSGi project I was working on, I've uploaded some of the code in my sandbox repository:
https://github.com/lburgazzoli/lb-sandbox-java/tree/master/sbox-camel/src/main/java/com/github/lburgazzoli/sandbox/camel— lb On Thu, Feb 6, 2014 at 2:44 PM, Claus Ibsen <claus.ib...@gmail.com> wrote: > On Thu, Feb 6, 2014 at 12:29 PM, manchandap <manchan...@yahoo.com> wrote: >> Thanks Claus for the quick reply. >> >> I had checked this link. My queries: >> >> # Where should the following code be placed that is in the main class (that >> runs the camel context) or some processor. >> > Anywhere where you want to trigger the logic that adds new routes to a > running CamelContext. >> /// load route from XML and add them to the existing camel context >> InputStream is = getClass().getResourceAsStream("barRoute.xml"); >> RoutesDefinition routes = context.loadRoutesDefinition(is); >> context.addRouteDefinitions(routes.getRoutes());/ >> >> # Would this require restart the camel that is the camel context >> # Can i achieve similar flexibility if I am using Java DSL to define my >> routes >> > Restart is not needed. You can add/remove routes on the fly. If you > want to update an existing route, you would need to stop and shutdown > it first, and then add the route (updates it) and then start it. > Yes the routes can be from XML or Java DSL. For Java DSL you can all > just use the addRoutes method that uses a RouteBuilder >> Thanks >> Prince Manchanda >> >> >> >> -- >> View this message in context: >> http://camel.465427.n5.nabble.com/Adding-Routes-to-a-running-Camel-Context-tp5746884p5746887.html >> Sent from the Camel - Users mailing list archive at Nabble.com. > -- > Claus Ibsen > ----------------- > Red Hat, Inc. > Email: cib...@redhat.com > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen > Make your Camel applications look hawt, try: http://hawt.io