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