OSGi: How does a service automatically detect client packages deployed at runtime?

I have a scenario where during the installation of a system several services were deployed in an OSGi container, and these services will listen to other packages that provide data and are dynamically installed and uninstalled at runtime.

These data providers do not provide any services and should not even refer to services; my idea is to allow pre-deployed services to listen for the installation event of these data provider packages and, if the pattern matches, then process and store the data in the data warehouse.

For example, I have a WidgetService that will listen to the Widget data provider package install or remove event, ShppingCartService that will listen to the ShoppableItem data provider install / uninstall events from packages, etc.

This helps me maintain centralized processing and persistent logic, and my data providers should not write code to process my data. All that is expected from data provider packages is the service name / identifier, service version, prerequisites, and the data they must publish.

I read several articles about OSGi that explain the dynamic connectivity of services and clients that are able to detect or refuse services based on their availability; however, all this speaks of scenarios when customers must be smart in order to discover and perform services of interest to them.

My intention is to make the client completely unaware of any service opening, no matter what code. All that the client goes through is information about the service the client is in, dependencies and data ; customer must be completely dumb.

Is this possible in OSGi? I am ready to consider this architecture even at the cost of extending several OSGi base classes!

, , : Bundle

, , . , . /, , , , .

OSGi, , ...

, /:), !

, OSGi, , . , , . , OSGi , OSGi.

, OSGi,

, Samba

+3
2

4.7 () OSGi Core. Framework BundleEvents, , . . , BundleListener, , .

+2

, "OSGi Mediator" , .

, , ; .

0

Source: https://habr.com/ru/post/1726683/


All Articles