camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: CamelContextLifecycle Has a Glaring Deficiency
Date Thu, 21 Nov 2013 10:27:27 GMT
Logged ticket to include this in Camel 2.13

For current Camel versions you can add a custom
org.apache.camel.spi.LifecycleStrategy and use its callbacks for when
routes is added. Then you can likely do some init logic there as well.

On Sat, Nov 9, 2013 at 3:11 AM, kraythe . <> wrote:
> The problem is that if we are using a ServletContextListener (jndi or
> simple) the lifecycle methods get called after the routes have been built.
> This prevents the routes from being able to use object in the registry. In
> specific, I register some configuration information there. To work around
> this, I subclassed JndiCamelServletContextListener and overrode
> createRegistry and used my subclass in the web.xml. However I shouldnt have
> to do this. What I propose is a code change to the
> CamelServletContextListener.
> There should be the following new methods:
> beforeAddRoutes(ServletCamelContext context, R registry)
> afterAddRoutes(ServletCamelContext context, R registry)
> They would be triggered in CamelServletContextListener in the appropriate
> places. By then, the registry is already up and able to take registrations
> so it shoulnt be a big deal. As I understand it Spring gets around this
> problem by reading the xml configuration before the routes are built.
> However spring is off the table of discussion for me.
> *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
> *Author of: Hardcore Java (2003) and Maintainable Java (2012)*
> *LinkedIn: **
> <>*

Claus Ibsen
Red Hat, Inc.
Twitter: davsclaus
Author of Camel in Action:

View raw message