camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From unmarshall <>
Subject Proper method of looking up osgi service from camel component
Date Mon, 28 Feb 2011 06:58:08 GMT
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:
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

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,

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message