Hi All,
I have created a custom camel component. The endpoint for the camel
component needs a service which is exposed by another osgi bundle. I found
that there are couple of ways to do that:
Solution 1: (Using camel API)
-------------------
Use CamelContextHelper.lookup("class name");
This will internally have the following call trace:
SpringOsgiCamelContext.getRegistry()
PropertyPlaceholderDelegateRegistry.lookup()
CompositeRegistry.lookup() - Here a list of registries are looked into. I
can see 2 registries -> OsgiRegistry & ApplicationContextRegistry.
Solution 2: (Using Spring API)
----------------
Have a bean implement BundleContextAware, this will then result in injection
of BundleContext
which can then be used to look up a service reference and then the required
service.
As of now i have adopted solution 1 (using the camel API) as the class that
required the service was a custom camel endpoint.
Is this the right way to do it or are there better alternatives?
Best Regards,
Madhav
--
View this message in context:
http://camel.465427.n5.nabble.com/Proper-method-of-looking-up-osgi-service-from-camel-component-tp3402863p3402863.html
Sent from the Camel - Users mailing list archive at Nabble.com.