So instead of <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-core</artifactId> <version>${camel-version}</version> </dependency>
I use camel-core-osgi and use the OsgiDefaultCamelContext instead and I should be safe? public void start(BundleContext context) throws Exception { camelContext = new OsgiDefaultCamelContext(context); ... } Will this enable me to use Camel commands in Karaf or will I have to use osgi:start command? Thanks, borut Dne 11. april 2012 05:51 je Claus Ibsen <claus.ib...@gmail.com> napisal/-a: > Hi > > Yeah that is how this can be done with OSGi APIs. > > You may want to use the camel-core-osgi JAR and use the > OsgiDefaultCamelContext as the CamelContext instance. > That one knows about the OSGi runtime. Otherwise you may run in trouble. > > > On Tue, Apr 10, 2012 at 3:02 PM, Borut Bolčina <borut.bolc...@gmail.com> > wrote: > > Hello, > > > > I was wondering if I am going down the right path. My goal is to deploy a > > simple Camel route to an OSGI container, but without the Spring "startup > > code". > > > > The route: > > > > public class WeatherCurrentRouteBuilder extends RouteBuilder { > > public void configure() { > > ... > > } > > } > > > > and to start and stop the route I implemented: > > > > public class WeatherCurrentBundleActivator implements BundleActivator { > > > > CamelContext camelContext; > > > > public void start(BundleContext context) throws Exception { > > camelContext = new DefaultCamelContext(); > > > > PropertiesComponent pc = new PropertiesComponent(); > > pc.setLocation("classpath:weather.properties"); > > camelContext.addComponent("properties", pc); > > > > camelContext.addRoutes(new WeatherCurrentRouteBuilder()); > > > > camelContext.start(); > > > > } > > > > public void stop(BundleContext context) throws Exception { > > camelContext.stop(); > > } > > > > } > > > > I added the maven-bundle-plugin into my pom to build the osgi bundle. > > > > Is this the way to go? > > > > Cheers, > > borut > > > > -- > Claus Ibsen > ----------------- > CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com > FuseSource > Email: cib...@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ >