Distributed OSGi Tutorial

Thumbnail for IoT Tutorial

This tutorial takes you through the steps to build a trivial Chat application using distributed OSGi. We first build a service API for a Chat client and use this API in an implementation. Then we add a command to test the implementation. After this works, we run a Zookeeper server from Bndtools. This Zookeeper server is used by the Amdatu Distributed OSGi implementation to distribute the Chat services. To finish it off, we create a client in the browser.

A disclaimer. This tutorial is about learning to use OSGi enRoute, not about learning Java, Git, Eclipse, nor the Raspberry Pi setup details. It is assumed that you have basic experience with these tools.

If you have any questions about this tutorial, please discuss them in the forum. And as always, pull requests are highly appreciated.


  1. Prerequisites – The prerequisites for the use of OSGi enRoute (Important!)
  2. Introduction to the Chat Tutorial – Introduction what we will build in this chat tutorial
  3. Designing an API – The design of the Chat API
  4. Implementing the Chat API – Creating a simple implementation of the Chat API using the console
  5. Using Gogo to Test our Implementation – Using Gogo to test out our implementation of the Chat API
  6. Configuration – Configuring the Chat service
  7. Zookeeper Server – Setting up a Zookeeper discovery server
  8. Distributing – Adding a Distribution Provider and exporting the service
  9. A Chat Web App – Creating a small Web App GUI on the Chat service


So, you’ve finished this tutorial! What’s next?

We’d love some feedback. Our most favorite feedback is a pull request on the documentation. As an early user you must have run into some rough edges, outright stupidities, or you had a brilliant idea. Just go to the OSGi enRoute repository on Github. Clone it in your own account, make your changes or additions, and send a pull request. We, and others like you, highly appreciate these kind of contributions.

After you’ve done this tutorial you should have a basic feeling of how to build an application using Distributed OSGi with OSGi enRoute. So the best way to continue learning is to build a small application based on these principles. Running into real problems is the best way to learn a technology. If you run into problems, use the Forum to ask questions and get answers.

And watch this space, we will expand this site with hundreds of data sheets of services you can find on the net. These data-sheets will show you how to use this service in your application with real examples.