woensdag 31 maart 2010

ECF Discovery: How many Zookeepers does it take to screw in a lightbulb?

image:zookeeperecf.gif
If you use OSGi remote services (See OSGi Compendium Specs chapter 13) you have to know the other end. In large installations this configuration can be quite cumbersome.

At Remain Software we develop software to manage nodes in a network. We want our nodes to register themselves to us when they are in the network. This is fine if you manage a small office but not if you manage smart lightbulbs in a sky scraper.

As soon as the lightbulb is screwed into its socket, it can tap some power to activate its OSGi runtime. The runtime will activate the ILightBulb interface with methods dim(int), on() and off() as a remote service. Now, how do we get this service to interested parties...

ECF For the Win
The ECF discovery framework enabled us to create a Zookeeper based Discovery implementation. An addition to the already existing JmDNS (Zeroconf/Bonjour) and jSLP implementations.

An Apache Zookeeper server will replicate configuration data between other Zookeeper servers. The Zookeeper servers know each other and clients know one Zookeeper Server. So the smart bulb (which runs OSGi or did I mention that already?) is preconfigured with the address of its nearest Zookeeper server or gets this information dynamically by some kind of IP broadcast.

image:zookeeperecf.gif

When the lightbulb publishes its Remote Service, ECF wakes up and publishes this service through the provided Discovery implementations. The Zookeeper discovery provider will immediately notify its nearest peers and the new lightbulb service is registered in all Zookeeper instances. When the Zookeeper instance that is connected to an interested party receives the data, the Discovery implementation will publish this service in that OSGi container.

The Lightbulb Control Center is waiting for the ILightBulb service and magically creates a UI in its console (the sparkles DO NOT appear in reality. I made that up).

The Building Maintainer can now control the lightbulb.


More..
For more information or if you want to Tinker with the code, please visit the wiki.

Acknowledgements
Ahmed Aadel, one of the great developers working at Remain Software created the Zookeeper Discovery Implementation. Thanks to Scott Lewis and Markus Kuppe from our ECF team for support and Chris Aniszczyk for easy access to Tinkerbell (tm)

Animations done with the Gimp.

3 opmerkingen:

  1. Cool!! I'm looking forward to getting the zookeeper discovery into ECF proper!

    BeantwoordenVerwijderen
  2. Thanks for touching this problem.
    For example Linux has huge art gallery with their penguin (e.g. http://www.angelfire.com/pe/penguindance/ )

    Whereas OSGi Tinkerbell(tm) users are left with no choice :-(
    This severely harms OSGi adoption!

    BeantwoordenVerwijderen
  3. I can't take full credit for the OSGi tinkerbell, it's split between Jeff McAffer, Paul Vanderlei and Martin Lippert and I ;)

    BeantwoordenVerwijderen