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

Reply via email to