You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by bbuzzard <Bi...@bnsflogistics.com> on 2012/07/31 19:22:46 UTC

Howto add routes to CamelContext on the fly.

I'm creating a java class that I want to add the the ActiveMQ-Camel libs that
will periodically query a database for routes and add or remove them from
the active camel context.  The camel.xml file contains some default routes
that I use all the time, but I will like to add new routes to the same
context.  Does anyone know how to get the active camel context?  If yes,
how?



--
View this message in context: http://camel.465427.n5.nabble.com/Howto-add-routes-to-CamelContext-on-the-fly-tp5716636.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Howto add routes to CamelContext on the fly.

Posted by Pontus Ullgren <ul...@gmail.com>.
Hello,

Provided that you add/remove the routes in a processor you can simply
get the current camel context from the Exchange[1].

If you need the camel context in another bean you can use dependency
injection when you create that bean.

[1] http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Exchange.html

Best regards
Pontus Ullgren

On Tue, Jul 31, 2012 at 7:22 PM, bbuzzard
<Bi...@bnsflogistics.com> wrote:
> I'm creating a java class that I want to add the the ActiveMQ-Camel libs that
> will periodically query a database for routes and add or remove them from
> the active camel context.  The camel.xml file contains some default routes
> that I use all the time, but I will like to add new routes to the same
> context.  Does anyone know how to get the active camel context?  If yes,
> how?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Howto-add-routes-to-CamelContext-on-the-fly-tp5716636.html
> Sent from the Camel - Users mailing list archive at Nabble.com.