Search code examples
osgijboss6.xjbossfusekaraffabric8

How to use dependent bundles in different container in Fabri8?


I am trying to understand the capabilities of Fabric8's container management. I just want to clarify weather the following scenario can be achieved by using Fabric8 in JBossFuse.

I have created simple 2 bundles (tick, tock bundles inspired by the : http://kevinboone.net/osgitest.html). Simply Tick bundle is exporting a package and Tock bundle is importing it. In another words, Tock Bundle depends on the Tick Bundle.

These 2 bundles are working perfectly when deployed in a single container (say in a one child container in JBoossFuse).

Then I have created a cluster by using the fabric8 and added its containers to the Fabric Ensemble as well.

And I have created 2 profiles. TickProfile contains the Tick bundle and Tock profile contains the Tock bundle.

I have deployed above 2 profiles in 2 different containers as follows,

enter image description here

Then it is not working properly because Tock bundle cannot resolve its dependency of Tick Bundle which is exposed by Tick Bundle (because those bundles are in two different containers).

I thought this is possible with fabric8 but it seems it cannot.

It would be really appreciated if someone can tell me whether there is any way of achieving this.

Thanks.


Solution

  • No this is not possible. Package export and import on OSGi level is bounded to the JVM. This means bundles in different JVMs will not be able to import each others classes.

    The only OSGi concept that supports clustering are Services. The OSGi specification calls that Remote Services.

    See: https://wiki.eclipse.org/Tutorial:_Building_your_first_OSGi_Remote_Service