Grading criteria changed: OSGi exercise provides now extra-points! In the OSGi framework there is however another way of declaring and using services, namely the OSGi Blueprinting mechanism which should be more easy way to create such service constellations (it hides the lifecycles and dependencies between services, and as far as I know, can also be used with service constellations having cyclic dependencies). Using OSGi Declarative Services created some technological complexities that were not foreseen by me! Especially, because cyclic dependecies are not tolerated, simply implementing the business logic for orchestrating a set of services does not work.
Using this quit complex configuration of OSGi bundles we have now created a simple service choreography. the eventhandlers must be registered in the activate() -methods of the backend implementations before the frontend implementations publish the corresponding events. This was needed to guarantee that events published by service frontends get consumed by the backends, i.e. In the runtime configuration illustrated in the screenshot above, the backend-parts of services are initiated before (they have runlevel 4) the frontends (with runlevel 5). by corresponding bind / unbind methods).Įach front- / backend-implementation utilizes now an activate() -method which is a callback method called by the OSGi platform after all service references for the service implementation have been resolved. For this purpose, each implementation uses the OSGi EventAdmin services reference to this OSGi infrastructure service given using the declarative service mechanism (i.e. and ) that are orchestrated with OSGi Event (publish-subscribe) mechanism. The service implementations were divided to front-end and back-end parts (e.g. For this reason, the service interfaces and their implementations are now implemented as distinct bundles. The biggest complexity became due to the features of OSGi DS to not allow cyclic dependencies between services. The example implementation became way too complex because the way OSGi Declarative Services runtime is designed. You should create a run configuration that is illustrated in this screenshot: sose-runconfiguration-screenshot.jpg The example projects can be run under the Eclipse by creating a new OSGi run configuration from the menu Run/Run Configurations. zip-file that you can import to your Eclipse -workspace here: osgi-example-projects.zip. The OSGi example projects are now finally available! You can find the.