Reusable services

You implement reusable code by calling an OSGi service from Java™ agents and rule agents. For example, the code might run complex calculations or call external systems.

Typically, a standard Java interface is used to define a service in OSGi. An OSGi bundle can register listeners to use an OSGi service, and be informed if a service is started or stopped. An OSGi service and OSGi bundles have the following relationships:

Implementer
The bundle that implements the service must register it. An OSGi service can be registered many times by the same or different bundles.
Consumer
The bundle that gets the service is the consumer. An OSGi service can be called many times by any bundle.
Listener
A listener is notified of registrations, modifications, and unregistrations of the service. A service can have many listeners.