This page describes the demo that shows the Discovery functionality of Distributed OSGi.
It assumes that you have set up your DOSGi/ZooKeeper based Discovery system as outlined in DOSGi Discovery.
@@@ this is work in progress @@@
Demo design
This demo contains of a display controller node that writes messages on all the available display instances. Display instances are realized as remote OSGi services, which are registered with the ZooKeeper-based Discovery system. The discovery system informs the controller, which is a consumer of the DisplayService, of any available remote instances of this service.
@@@ add an image here @@@
As with most of the other demos, the actual implementation consists of 3 bundles.
- A DisplayService interface bundle.
- A DisplayService implementation bundle.
- A DisplayService client bundle, which takes the role of the display controller.
The Display Service interface is like this:
public interface DisplayService { boolean displayText(String text); String getID(); }
The Display Service Controller
Let's start with the controller, which is a consumer to the the DisplayService. It's simply using an OSGi ServiceTracker to consume all DisplayService services. It uses a Scheduled Executor to periodically send test messages to all registered displays.