You need to start the CamelContext first Also we dont encourge end user to create their own osgi camel context, as there is a bunch of stuff you need to do this so its correct.
Take a look at how eg camel-scr for example does some stuff. On Tue, Feb 21, 2017 at 4:51 PM, souciance <[email protected]> wrote: > Before running it a second time, you can run bundle:list to see if that > bundle containing the first consumer is active or not. > > On Tue, Feb 21, 2017 at 3:45 PM, alexey-s [via Camel] < > [email protected]> wrote: > >> There are two OSGI bundle. >> >> First OSGI bundle >> >> from("direct-vm:makeDoc") >> .bean(loacalBean, "make"); >> >> >> Second OSGI bundle >> >> void execute(String entityGuid) { >> SimpleRegistry registry = new SimpleRegistry(); >> BundleContext bundleContext = FrameworkUtil.getBundle( >> ImportDoc.class).getBundleContext(); >> OsgiDefaultCamelContext camelContext = new >> OsgiDefaultCamelContext(bundleContext, >> registry); >> >> ProducerTemplate template = camelContext.createProducerTemplate(); >> >> template.sendBody("direct-vm:ccweMakeDocumentByEntityGuid", >> entityGuid); >> >> camelContext.stop(); >> } >> >> Starting Apache Karaf. >> The first time the method runs smoothly. >> The second call results in an error >> >> Caused by: org.apache.camel.component.directvm. >> DirectVmConsumerNotAvailableException: No consumers available on >> endpoint: Endpoint[direct-vm >> ://makeDoc]. Exchange[ID-localhost-49500-1484729787207-82-2] >> at org.apache.camel.component.directvm.DirectVmProducer. >> process(DirectVmProducer.java:56)[53:org.apache.camel.camel-core:2.17.3] >> >> >> Why component "direct-vm:makeDoc" was stopped from another CamelContext? >> >> The error is repeated in the next versions >> camel 2.17.3 >> camel 2.18.2 >> >> >> >> >> Aleksey >> >> ------------------------------ >> If you reply to this email, your message will be added to the discussion >> below: >> http://camel.465427.n5.nabble.com/Stop-component-direct-vm- >> from-another-OSGI-camelContext-tp5794194.html >> To start a new topic under Camel - Users, email >> [email protected] >> To unsubscribe from Camel - Users, click here >> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=> >> . >> NAML >> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> >> > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Stop-component-direct-vm-from-another-OSGI-camelContext-tp5794194p5794196.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
