camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Typesafe Bean injection in routes using Registry
Date Wed, 18 Jan 2012 15:49:33 GMT
Hi Billy

Charles Moulliard is working on a camel-cdi component. So I guess the
questions to make the bean and beanRef more modern to the worlds of
OSGi and CDI could make sense.

Either we could do

Ensure all lookups is done only from beanRef (to refer to something
that is being looked up).
And then leave .bean as to invoke an existing bean. eg we @deprecated
the .bean(class) and .bean(String) methods.

Let .bean be able to lookup as well as if you are using .beanRef. So
this will adjust .bean(class) to lookup instead of currently to
instantiate a new instance from the class. This is a API breaking and
thus can only be done in next release.
And we need to indicate this in the release notes.

The .bean(class) was also mostly added because back then we were lazy
in unit testing, and just wanted Camel to invoke a bean, without the
need to setup the registry and whatnot. I do not know how many uses it
for real as well?

Anyway for CDI and OSGi we should possible also add a way to specify
that filter discrimination.

On Mon, Jan 9, 2012 at 12:49 PM, Billy <> wrote:
> Hi again Claus,
> Yes, I also think that this is a neat concept and fits well with the
> "de-Spring-ification" that Camel is currently undergoing.
> I also noted that the registry has the type lookup option, which led me to
> believe that it could be used from the routes as well. My implementation of
> the registry SPI is basically a rip of the project I mentioned in the last
> post:
> Seems like the author has come a long way of integrating Camel with CDI,
> using i.e. CDI to scan for type converters, routes contexts etc. My need was
> much more basic so I opted to only use the registry to reference my business
> beans for the routes. Perhaps his work could be merged into a camel-cdi
> component if the author would like to contribute?
> I can only agree that the bean options are confusing, especially with
> regards to when the registry is used and when Camel will take care of
> instantiating classes. This obviously plays a large role if the bean has
> dependencies and in multi concurrent scenarios (are my objects scoped as
> singletons/prototypes, etc..).
> Would love to continue the discussion, thanks for your response!
> /Billy
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message