Question

I need to create and deploy an application into Karaf. But I need to use camel component and java component (simple spring bean). The flow should be as follows:

WebService(not matter for me) -> camel-component -> spring-bean -> camel-component -> WebService(not matter for me).

This is just a simple routing. But what I need is the directory structure of OSGi bundle that karaf accepts and deploys.

For e.x. I have:

su-camel
  -src
    -main
      -resources
        -META-INF
          xbean.xml (spring-bean)
    -test
      -java
      -resources

su-bean
  -src
    -main
      -java
      -resources
        -META-INF
          xbean.xml (spring-bean)
    -test
      -java
      -resources

I am packaging all with maven, so what directory structure I should keep in the OSGi bundle .jar file that the application will be deployed correctly? As you can see there is two src directories in su-camel module, and su-bean module.

I know that servicemix accepts the .zip file with all components added with the structure explained above. Does karaf supports structure like that?

Was it helpful?

Solution

The proper OSGi solution would be to create two bundles, one for each project and deploy them both. If you don't want to do this, you can use the Embed-Dependency property in the manifest of your project to include the dependency (camel) packages. This will create just one bundle for you to deploy

OTHER TIPS

The simplest solution is to create just one bundle with the bean and the camel route. Normally there is no need to split the route from the bean. If you need to split it for some reason then simply use two bundles.

To make the deployment easier you can use a karaf feature file where you list both bundles and eventually their further dependencies. Karaf also supports .kar files that can contain many bundles. The kar files are the way to go if you karaf server has no access to a maven repo.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top