OSGi Declarative Service-based consumer does not register proxy service on
demand
---------------------------------------------------------------------------------
Key: DOSGI-73
URL: https://issues.apache.org/jira/browse/DOSGI-73
Project: CXF Distributed OSGi
Issue Type: Bug
Components: DSW
Affects Versions: 1.2
Environment: Equinox 3.6 with DS
Reporter: David Bosschaert
When using OSGi Declarative Services (DS) you can express interest in an OSGi
service through an XML descriptor, like this one (from the samples/ds demo):
{code:xml}<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
name="DS Consumer Sample" activate="start">
<implementation
class="org.apache.cxf.dosgi.samples.ds.consumer.AdderConsumer"/>
<reference interface="org.apache.cxf.dosgi.samples.ds.AdderService"
name="AdderService" cardinality="1..1" policy="dynamic" bind="bindAdder"
unbind="unbindAdder"/>
</scr:component>{code}
The declarative services implementation will then inject your service into your
component.
With CXF-DOSGi a remote service is always registered on-the-fly when a service
is requested. This is done through a ListenerHook. The listenerhook gets called
with the filter of services that are looked up by a consumer, e.g. what the
consumer passed in to a ServiceTracker.
It seems like the DS implementation uses a single tracker or listener for all
the services it's interested in, which probably uses an empty filter. This is
currently ignored by the CXF-DOSGi listener hook implementation, which means
that the AdderService proxy is not automatically injected in the component.
There is a workaround. Simply create a bundle (any bundle) in the consumer that
registers a service tracker to listen for the service that you want to be
discovered remotely.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.