Hi Roshan,

I may have a solution may have a solution to your problem. Yesterday I had a chat with Achim Nierbeck from Karaf and Pax Web. We talked about integration on OSGi
and if the NMR is needed or not.

So while using the NMR is one option for you Achim also told me he had succesfully used the seda component to talk between bundles. He simply published the seda component with interface Component as an OSGi service. Then he added a service reference to the other bundles. In spring having a bean with id seda means for camel that there is a component seda. Without spring you can simply
add the component by hand.

So this could be an easy solution. It is quite elegant as it only needs to register / reference the component once and then it can be used like normal.

Christian


Am 15.02.2011 17:16, schrieb Roshan A. Punnoose:
Hi,

I am looking for an osgi camel component that acts sort of like a "direct/seda" 
endpoint between bundles.

For example,

Bundle A:
from("something").to("osgidirect:endpoint")

Bundle B:
from("osgidirect:endpoint")...

Bundle C:
from("osgidirect:endpoint")...

I have been able to develop something like this and it is working in the OSGi 
container, but I was wondering if there is something already available out 
there like this.

If not, I can explain how I did this, and get your advice on how to proceed.

So the component works by registering and consuming osgi services. The Consumer gets registered as 
an OSGi service with property (endpointName="endpoint"), the Producer pulls all services 
with an OSGi filter of (endpointName="endpoint"). And all this seems to work.

My only issue is how I access the BundleContext. To be able to register and 
consume services, I need access to the BundleContext of the bundles that are 
consuming/producing (Bundle A/B/C). The way I have gotten around this right 
now, is to make sure that I always define the Consumer as a Spring Bean, and 
implement BundleContextAware, so that Spring DM will inject the BundleContext. 
However, I don't want to impose this restriction. Looking through the source 
code, I noticed that the OsgiCamelContext (or OsgiSpringCamelContext) holds the 
bundleContext as a private variable. Is there anyway we could expose that 
bundleContext somewhere on the context so that when I create the 
Consumer/Producer I can pull this from the CamelContext in some way? (Or is it 
exposed someway already that I haven't seen?)

Thanks so much!

Roshan

--
----
http://www.liquid-reality.de

Reply via email to