camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Posta <christian.po...@gmail.com>
Subject Re: Apply change to a route after loading camelcontext xml using GenericApplicationContext
Date Mon, 19 Aug 2013 23:30:52 GMT
You might want to stop the route first.


On Mon, Aug 19, 2013 at 3:01 PM, bonnahu <bonnahu@gmail.com> wrote:

> Hi guys,
> I have a piece of code below. What I want to do is to load a camelcontext
> from a xml file by using
> GenericApplicationContext and XmlBeanDefinitionReader. Then I want to make
> some change on one route,
> for example, setting the autoStartup property to false. At last, start
> camelcontext using Main class.
> However, for some reason, the changing to the route has not been effective,
> the route still starts.
> Did I make any mistake here? Thanks a lot!
>
>         GenericApplicationContext ctx = new GenericApplicationContext();
>         XmlBeanDefinitionReader xmlReader = new
> XmlBeanDefinitionReader(ctx);
>         xmlReader.loadBeanDefinitions(new
> ClassPathResource("camelcontext.xml"));
>         ctx.refresh();
>         // get the camelContext by using getBean()
>         CamelContext context = (CamelContext) ctx.getBean("mycontextID");
>         context.getRoute("route1").getRouteContext().setAutoStartup(false);
>
>         Main main = new Main();
>         main.setApplicationContext(ctx);
>         main.enableHangupSupport();
>         main.run();
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Apply-change-to-a-route-after-loading-camelcontext-xml-using-GenericApplicationContext-tp5737541.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message