Question

When I use OSGi API (an instance of ServiceRegistration) I can easily change the properties of service at runtime. How can I do the same with declarative service ? Is there any solution based on BndTool's annotation?

Many Thanks

Était-ce utile?

La solution

The answer is no. A service registered by DS for a component gets is service properties from the component properties. The component properties are set by the component description in the XML and also any Config Admin configuration used. Since you cannot change the XML, you can only change the configuration which is not something a component itself is expected to do.

If you need to change your service's service properties on the fly, your use case falls outside of the use cases supported by DS. You will need to use the OSGi service API.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top