Hasindu Dahanayake
Hasindu Dahanayake

Reputation: 1491

Is it okay to have two service Interfaces in the same osgi bundle?

I am developing a small project for super market,in that project I am having a bundle called SuperMarketServiceProducer. In that bundle I am planning to produce services to two different consumers called cashier and super market manager.So ManagerServiceImpl and CashierServiceImpl have different methods,because of that I need to use two different service interfaces for each of them separately called CashierService and ManagerService .So I need to know if I do like this and register them as two different services will it be okay,because in here I can't implement a common interface for their respective impl classes because of they are having different methods.

Upvotes: 0

Views: 197

Answers (1)

Christian Schneider
Christian Schneider

Reputation: 19606

A bundle in OSGi can publish any number of services with any number of interfaces. I recommend to use the declarative services runtime and annotations. This allows to easily define and use your services.

See https://github.com/cschneider/osgi-best-practices for examples of how to use the annotations.

Upvotes: 1

Related Questions