camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Adding Routes to a running Camel Context
Date Thu, 06 Feb 2014 13:43:10 GMT
On Thu, Feb 6, 2014 at 12:29 PM, manchandap <manchandap@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: cibsen@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

Mime
View raw message