I am trying without success to look for CamelContext inside the stop method
of a BundleActivator.
I did follow the instructions of Jean-Baptiste Onofré's Blog ("/When Camel
is used in an OSGi environment, it automatically exposes CamelContexts as
OSGi services/"), eg:
public class MyBundleActivator implements BundleActivator {
public void stop(BundleContext bundleContext) throws Exception {
ServiceReference[] references =
bundleContext.getServiceReferences(CamelContext.class.getName(), null);
CamelContext cc = null;
if ( references != null && references.length>0 ) {
cc = (CamelContext)
bundleContext.getService(references[0]);
}
}
}
but it does not work :-(
(I am using Camel 2.8.5 , ServiceMix 4.4.2)
What am i doing wrong ?
Is it possible that at the time the shutdown hook is called, the camel
context has been already deregistered ?
If so, what would be an alternate(*) solution to do some work at bundle stop
time, using spring beans ?
(*) rather than getting camel context, and looking for such bean throuhg
camel registry...
Thx,
Bernard.
Bernard.
--
View this message in context:
http://camel.465427.n5.nabble.com/Access-camel-context-from-BundleActivator-stop-tp5722376.html
Sent from the Camel - Users mailing list archive at Nabble.com.