camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Camel Osgi JMS
Date Fri, 18 Feb 2011 07:48:29 GMT
You can use the # notation in the endpoint uri to lookup any bean from
the registry with the given id.


But it must have a name to lookup? It cannot lookup by type and just
pick the first one?

We could of course add such a feature, and have a convention if there
is exactly only 1 of the given type, then use that. If 2+ then throw
an ambiguous error.

There is a lookupByType API on the registry we can leverage for that.
Although we may need some convention so when you use # it will lookup
by id first, and then fallback by type. Or we can introduce a syntax
to indicate by type, such as: #!

The downside when doing this is that you rely on there only being
excactly 1 type in the registry. And with OSGi things can be hot
deployed, so what happens if some other bundle registers 1 new JMS
connection factory. Now there is 2 in the osgi service registry. And
then you may restart your bundle, and when it startup again it detects
2 JMS connection factories, and fail to start.

On Thu, Feb 17, 2011 at 9:40 PM, Roshan A. Punnoose
<> wrote:
> Usually we use spring to set up the camel jms component before using, but I wanted to
know if it is possible to reference any bean in the camel registry by name for the connectionFactory.
> For example, let's say that I have the jms connection factory exposed as an osgi service
in my container. Thanks to camel, I can actually search the osgi service registry with my
camel registry by just asking for any bean with name "javax.jms.ConnectionFactory". That will
return the first JMS Connection Factory as a bean from teh camel/osgi registry. Is there anyway
in the camel-jms component to do something where I can refer to that connection factory instead
of writing up a spring configuration to do the same?
> Something like:
> from("jms:topic:heartBeatWithCounts?connectionFactory=javax.jms.ConnectionFactory")
> Roshan

Claus Ibsen
Twitter: davsclaus
Author of Camel in Action:

View raw message