I'm busy coming to grips with Camel and Karaf. I've built a project with two bundles:
- Bundle A contains a Blueprint Camel route
- Bundle B contains a pure Java route
I followed the instructions from Jamie Goodyear's Karaf Cookbook
Both routes are super simple and I deploy them using a feature file. They deploy perfectly and also run exactly as planned:
Bundle A moves files from /tmp/in
to /tmp/out
Bundle B moves files from /tmp/in2
to tmp/out2
All good.
However, if I run the Karaf command camel:route-list
then only the Blueprint route is shown
Also, if I run camel:context-list
then only the context defined in Bundle A is shown.
Just to reiterate, both routes work correctly, it's just the the Java ones aren't showing up in the list.
Am I missing something here?
Here's my Java Route:
public class FileRouter extends RouteBuilder {
public void configure()
{
from ("file:/tmp/in2?noop=true")
.log("Java DSL doing the heavy lifting")
.to("file:/tmp/out2");
}
}
And the Bundle Activator:
public class Activator implements BundleActivator {
DefaultCamelContext camelContext;
public void start(BundleContext context) {
System.out.println("Starting the bundle");
camelContext = new DefaultCamelContext();
try {
camelContext.setName("JavaDSLContext");
camelContext.addRoutes(new FileRouter());
camelContext.start();
} catch (Exception ex) {
System.out.println("Exception occured! " + ex.getMessage());
}
}
public void stop(BundleContext context) {
System.out.println("Stopping the bundle");
if (camelContext != null) {
try {
camelContext.stop();
} catch (Exception ex) {
System.out.println("Exception occured during stop context.");
}
}
}
}