On Thu, Nov 15, 2012 at 11:53 AM, ddewaele <[email protected]> wrote: > Hi, > > I'm deploying Camel as an OSGI bundle (part of an EBA) on Websphere using > the Spring OSGI extender. > When the bundle is started, the camelContext is started and the route is up > and running. > > I did notice however that it is not detecting that it is running in an OSGI > environment and as such is not using the OsgiSpringCamelContext. > > This results in issues like TypeConverter package scanning not working in > the OSGI container. > > Camel requires that the camel-spring bundle is STARTED before any bundles > are started containing camel routes. > > What is the preferred way of dealing with this start-order dependency ?
The preferred way in OSGI is having a BundleListener listen for a STARTED event. You'd put this in the bundles that are trying to create routes. http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleListener.html If you have a number of bundles dependent in this way, you might want to create a bundle that does the listening for the camel-spring bundle and publishes a service the other bundles submit custom listeners to. That reduces, or at least centralizes, your dependence on extenal events. It's possible to do this using Camel without Spring also, but you'll need to listen for the publishing of the appropriate endpoint module services also. Starting the Camel bundle isn't enough; some modules start after and register themselves with camel-core. Don
