You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Anto Paul <an...@gmail.com> on 2009/09/30 15:04:35 UTC

Lifecycle events of CamelContext

Hi,
    How to get lifecycle events of CamelContext?. I need to know when
CamelContext is initialised. I am looking something like Spring
ApplicationListener. I need CamelContext after initialization so that I can
add new routes after reading them from database.

    As of now I am using Camel Event component to listen for events. Is this
the right way to do it?.

Anto

Re: Lifecycle events of CamelContext

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

The org.apache.camel.spi.LifecycleStrategy is for that.

In the code in the trunk you just implement a bean with this interface
and then add that as a spring bean to the xml file

<bean id="myLS" class="com.mycompany.MyLifecycelStrategy"/>

And Camel will take it from there and invoke the callbacks on your class.

In 2.0 or older Camel only had "room" for a single LifecycleStrategy
which would then rule out the JMX instrumentation.

Camel does *not* fire spring events.


On Wed, Sep 30, 2009 at 3:04 PM, Anto Paul <an...@gmail.com> wrote:
> Hi,
>    How to get lifecycle events of CamelContext?. I need to know when
> CamelContext is initialised. I am looking something like Spring
> ApplicationListener. I need CamelContext after initialization so that I can
> add new routes after reading them from database.
>
>    As of now I am using Camel Event component to listen for events. Is this
> the right way to do it?.
>
> Anto
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus