camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
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 <> 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:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Red Hat, Inc.
Twitter: davsclaus
Author of Camel in Action:
Make your Camel applications look hawt, try:

View raw message