Dynamically created CamelContext not visible in fuse console
Hi, I got 2 camel contexts defined in xml and a bunch of others i created dynamically with: CamelContext camelContext = new SpringCamelContext(applicationContext); The point is, when doing "camel:context-list" in the JBoss Fuse 6.2 console, is only get to see the 2 (fixed) ones. In hawtio i see them all! How can i fix this? Regards Rino -- View this message in context: http://camel.465427.n5.nabble.com/Dynamically-created-CamelContext-not-visible-in-fuse-console-tp5774855.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Dynamically created CamelContext not visible in fuse console
You need to create them as osgi camel context, and do a bunch of osgi initialization to make that work. Its not so easy to do but see in camel-core-osgi source code On Wed, Dec 9, 2015 at 1:35 PM, rwijngaa <rino.van.wijngaar...@gmail.com> wrote: > Hi, > > I got 2 camel contexts defined in xml and a bunch of others i created > dynamically with: >CamelContext camelContext = new SpringCamelContext(applicationContext); > > The point is, when doing "camel:context-list" in the JBoss Fuse 6.2 console, > is only get to see the 2 (fixed) ones. In hawtio i see them all! > > How can i fix this? > > Regards > Rino > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Dynamically-created-CamelContext-not-visible-in-fuse-console-tp5774855.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
Re: Dynamically created CamelContext not visible in fuse console
ok, tried that. CamelContext camelContext = new OsgiSpringCamelContext(getApplicationContext(), Activator.getBundleContext()); ((OsgiSpringCamelContext)camelContext).setName(contextId); The OsgiSpringCamelContext constructor is calling OsgiCamelContextHelper.osgiUpdate(this, bundleContext)) and this seems to do a lot of OSGi initialisation, but still no luck ! note: Activator is copied from org.apache.camel.osgi.Activator and present in my bundle's manifest as Bundle-Activator. Any pointers would be apprecciated Regards Rino -- View this message in context: http://camel.465427.n5.nabble.com/Dynamically-created-CamelContext-not-visible-in-fuse-console-tp5774855p5774864.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Dynamically created CamelContext not visible in fuse console
Yeah that's the guy that triggers some osgi code that enlist the camel context in the osgi service registry at that bundle, which is what the karaf camel command uses. See also how camel-scr does some stuff as it does also manually do some osgi initialization https://github.com/apache/camel/blob/master/components/camel-scr/src/main/java/org/apache/camel/scr/AbstractCamelRunner.java On Wed, Dec 9, 2015 at 4:49 PM, Antonin Stefanutti <anto...@stefanutti.fr> wrote: > You need the following piece of code to be executed so that your Camel > contexts get published as OSGi services: > > context.getManagementStrategy().addEventNotifier(new > OsgiCamelContextPublisher(BundleContextUtils.getBundleContext(getClass(; > > Then your Camel contexts will be visible from Camel Karaf commands. > > Antonin > >> On 09 Dec 2015, at 15:52, rwijngaa <rino.van.wijngaar...@gmail.com> wrote: >> >> ok, tried that. >> >>CamelContext camelContext = new >> OsgiSpringCamelContext(getApplicationContext(), >> Activator.getBundleContext()); >> ((OsgiSpringCamelContext)camelContext).setName(contextId); >> >> >> The OsgiSpringCamelContext constructor is calling >> OsgiCamelContextHelper.osgiUpdate(this, bundleContext)) and this seems to do >> a lot of OSGi initialisation, but still no luck ! >> note: Activator is copied from org.apache.camel.osgi.Activator and present >> in my bundle's manifest as Bundle-Activator. >> >> Any pointers would be apprecciated >> Regards >> Rino >> >> >> >> -- >> View this message in context: >> http://camel.465427.n5.nabble.com/Dynamically-created-CamelContext-not-visible-in-fuse-console-tp5774855p5774864.html >> Sent from the Camel - Users mailing list archive at Nabble.com. > -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
Re: Dynamically created CamelContext not visible in fuse console
You need the following piece of code to be executed so that your Camel contexts get published as OSGi services: context.getManagementStrategy().addEventNotifier(new OsgiCamelContextPublisher(BundleContextUtils.getBundleContext(getClass(; Then your Camel contexts will be visible from Camel Karaf commands. Antonin > On 09 Dec 2015, at 15:52, rwijngaa <rino.van.wijngaar...@gmail.com> wrote: > > ok, tried that. > >CamelContext camelContext = new > OsgiSpringCamelContext(getApplicationContext(), > Activator.getBundleContext()); > ((OsgiSpringCamelContext)camelContext).setName(contextId); > > > The OsgiSpringCamelContext constructor is calling > OsgiCamelContextHelper.osgiUpdate(this, bundleContext)) and this seems to do > a lot of OSGi initialisation, but still no luck ! > note: Activator is copied from org.apache.camel.osgi.Activator and present > in my bundle's manifest as Bundle-Activator. > > Any pointers would be apprecciated > Regards > Rino > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Dynamically-created-CamelContext-not-visible-in-fuse-console-tp5774855p5774864.html > Sent from the Camel - Users mailing list archive at Nabble.com.