Realized I only sent this to Claus before: 

Yeah that worked. so now my route looks like: 
from("jms:topic:heartBeatWithCounts?connectionFactory=#javax.jms.ConnectionFactory")

Yeah that is the problem with having osgi services for this is that multiple 
ones can be used. The way I believe to fix that is to set the service ranking 
higher on the service we really want, but still a problem.

________________________________________
From: Claus Ibsen [[email protected]]
Sent: Friday, February 18, 2011 2:48 AM
To: [email protected]
Cc: Roshan A. Punnoose
Subject: Re: Camel Osgi JMS

You can use the # notation in the endpoint uri to lookup any bean from
the registry with the given id.

?connectionFactory=#myFactory

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
<[email protected]> 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
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

--
Follow this link to mark it as spam:
http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=64E3327DFA.AFD5C


Reply via email to