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: Dynamic Routes aadition in Standalone application
Date Thu, 09 Jul 2015 09:55:23 GMT
See the api on CamelContext where you can add routes.

On Thu, Jul 9, 2015 at 10:42 AM, fxthomas <felix.thomas@gmail.com> wrote:
> hello,
>
>    I have write some code to start camel in Standalone mode , with some
> routes . But how do I make the roue addition dynamic without restarting the
> camel instance.  I will be updating the route dynamically based on some
> triggers in my application. Looking at the standalone approach I dont see it
> possible without restarting the camel instance.
>
> Below is my code
>
> // create a Main instance
>                 main = new Main();
>                 main.enableHangupSupport();
>
>                 // add routes
>                         main.addRouteBuilder(new
> CustomDynamicRouteBuilderWithoutContext("rabbitmq://localhost/"+EXCHANGE_NAME+"?autoDelete=false&queue="+QUEUE_NAME+"&username=guest&password=guest&routingKey="+ROUTING_KEY,"stream:out","XML"));
>                         main.addRouteBuilder(new
> CustomDynamicRouteBuilderWithoutContext("select * from
> TBL_DB","stream:out","DB"));
>
>                         // incase of DB need to provide Datasource Object
>
> main.bind("DS",setupDataSource1("jdbc:oracle:thin:@nero2:15521:FYR"));
>
>                         // enable hangup support so you can press ctrl + c to terminate
> the JVM
>                         // run until you terminate the JVM
>
>                         System.out.println("Starting Camel. Use ctrl + c to terminate
the
> JVM.\n");
>                         main.run();
>
>
> How do I add new routes without restarting the camel application, is there
> any way or other approach I could try.
>
>
> regards,
> Felix T
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Routes-aadition-in-Standalone-application-tp5769018.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
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message