The OSGi specification defines the following four different layers:
The services layer allows bundles to communicate by defining an API that can cross bundle layers. However, the services layer also allows the services to come and go dynamically, instead of being fixed at runtime.
This mechanism allows services to be exported over a network, and since the network can come and go (as can the remote endpoint), the OSGi services layer can replicate that same functionality.
Responding to services that dynamically come and go may add a slight difficulty to the client code, but it will be more robust in case of failure. The next sections will present different ways to achieve dynamism in services.