Work with the OSGi service registry
We can create an object and register it as an OSGi service for use by third-party features deployed to the Liberty profile.
Services are the OSGi lightweight and flexible component model. When we create services and wire them together with Java code, we can use mechanisms such as ServiceTrackers to help find the services we want, and Declarative Services (DS) and Blueprint to specify the wiring declaratively. The Liberty profile has standardized on using DS for wiring, except for a small number of cases where extra flexibility is required.
Subtopics
- Register OSGi services
We can create an object and register it as an OSGi service for use by third-party features.
- Use OSGi services
Services can be registered and unregistered asynchronously at any time. Therefore we should call a service for as short a time as possible. We can use the ServiceTracker class to track service availability concurrently.
Parent topic: Develop an OSGi bundle with simple activationTasks:
Develop a custom TAI as a Liberty profile feature Auto-provisioning a feature Develop a custom user registry Develop a custom thread identity service