felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bourret Pierre <bourr...@gmail.com>
Subject Re: Remote iPojo and Event Admin
Date Mon, 14 Mar 2011 15:34:17 GMT
Hello,

1) First, despite the fact that you've specified "osgi.remote.*" properties
for your component instance declaration, these properties are not exposed
with the service you provide. You can check that by looking at the service
exposed by your component in the Webconsole : none of the "osgi.remote.*"
properties you specified should be present, so DOSGi cannot export the
service.

You must change the component specification to explicitly expose these
properties as service properties, e.g. :

       <!-- The synchronous donut provider -->
       <component classname="fr.eventadmin.test.provider.DonutProviderImpl"
name="synchronous-donut-provider">
               <!-- Expose the donut provider service -->
               <provides specifications="fr.eventadmin.
test.remote.DonutProvider">
                       <property name="name" field="m_name" value="Unknown
donut vendor" />
                       *<!-- Properties inside the provides element, so they
are service properties -->*
*                       <property name="osgi.remote.interfaces"
type="java.lang.String" value="*" />*
*                       <property name="osgi.remote.configuration.type"
type="java.lang.String" value="org.apache.cxf.ws" />*
*                       <property name="**
osgi.remote.configuration.pojo.address**" type="java.lang.String" value="**"
/>*
               </provides>
               <!-- Donut publisher -->
               <ev:publisher name="donut-publisher" field="m_publisher"
topics="food/donuts" data-key="food" synchronous="true" />
       </component>

              <!-- Instance declaration -->
       <instance component="synchronous-donut-provider" name="Begniers de
Pomme">
               <property name="name" value="Begniers de pomme" />
               <property name="osgi.remote.configuration.pojo.address"
value="http://localhost:9094/Donut" />
       </instance>

With these metadata, your component endpoint should now be accessible from
the configured address.


2) Then, by doing this, only the service you provide is exported by DOSGi,
not the event part. Event handling is achieved by using the EventAdmin
service (not directly, but via the event-admin-handler), and this service
uses whiteboard pattern to notify the event listeners : each listener must
provided a EventHandler service, consumed by the EventAdmin.
So if you want your (remote) consumers to receive events fired be the donut
provider, you have to import all the EventHandler services provided by the
consumers on the framework running the provider. This may be hard to achieve
because of technical restriction (clients are not supposed to export any
service, server must discover and import the clients, ...).
However, events and services are very different concepts, so exporting
events with DOSGi, designed for services, may be complicated and painful...
Maybe you could use an event based protocol/API to share your events between
framework instances, as XMPP, AMQP, JMS, ...



On 14 March 2011 14:41, <mna.ipojo@free.fr> wrote:

> Hi everyboby !
>
> I want to use the publisher/subscriber principe using remote objects. So i
> used
> this project
> (
> http://people.apache.org/~clement/ipojo/tutorials/dosgi/dosgi-tutorial.zip)
> and
> try to make it works.
> Every thing's ok !
>
> then, from sources, i get the test projet
> .\trunk\ipojo\tests\handler\eventadmin\ and try to make it works too.
> Every thing's ok !
>
> Now, when i merge both, no web service are created... Components are well
> started but it seams that ev:publisher is not handle. Here the metadata for
> the
> provider :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ipojo
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="org.apache.felix.ipojo
> http://felix.apache.org/ipojo/schemas/SNAPSHOT/core.xsd"
>        xmlns="org.apache.felix.ipojo"
>        xmlns:ev="org.apache.felix.ipojo.handlers.event">
>
>        <!-- The (asynchronous) donut provider -->
>        <component
>                classname="fr.eventadmin.test.provider.DonutProviderImpl"
>                name="donut-provider" >
>                <!-- Expose the donut provider service -->
>                <provides
>
>  specifications="fr.eventadmin.test.remote.DonutProvider">
>                        <property
>                                name="name"
>                                field="m_name"
>                                value="Unknown donut vendor" />
>                </provides>
>                <!-- Donut publisher -->
>                <ev:publisher
>                        name="donut-publisher"
>                        field="m_publisher"
>                        topics="food/donuts"
>                        data-key="food"
>                        synchronous="false" />
>        </component>
>
>        <!-- The (asynchronous) donut provider using publishes -->
>        <component
>                classname="fr.eventadmin.test.provider.DonutProviderImpl"
>                name="donut-provider-publishes">
>                <!-- Expose the donut provider service -->
>                <provides
>
>  specifications="fr.eventadmin.test.remote.DonutProvider">
>                        <property
>                                name="name"
>                                field="m_name"
>                                value="Unknown donut vendor" />
>                </provides>
>                <!-- Donut publisher -->
>                <ev:publishes
>                        name="donut-publisher"
>                        field="m_publisher"
>                        topics="food/donuts"
>                        dataKey="food"
>                        synchronous="false" />
>        </component>
>
>        <!-- The synchronous donut provider -->
>        <component
>                classname="fr.eventadmin.test.provider.DonutProviderImpl"
>                name="synchronous-donut-provider">
>                <!-- Expose the donut provider service -->
>                <provides
>
>  specifications="fr.eventadmin.test.remote.DonutProvider">
>                        <property
>                                name="name"
>                                field="m_name"
>                                value="Unknown donut vendor" />
>                </provides>
>                <!-- Donut publisher -->
>                <ev:publisher
>                        name="donut-publisher"
>                        field="m_publisher"
>                        topics="food/donuts"
>                        data-key="food"
>                        synchronous="true" />
>        </component>
>
>        <!-- The synchronous donut provider using dataKey -->
>        <component
>                classname="fr.eventadmin.test.provider.DonutProviderImpl"
>                name="synchronous-donut-provider-2">
>                <!-- Expose the donut provider service -->
>                <provides
>
>  specifications="fr.eventadmin.test.remote.DonutProvider">
>                        <property
>                                name="name"
>                                field="m_name"
>                                value="Unknown donut vendor" />
>                </provides>
>                <!-- Donut publisher -->
>                <ev:publisher
>                        name="donut-publisher"
>                        field="m_publisher"
>                        topics="food/donuts"
>                        dataKey="food"
>                        synchronous="true" />
>        </component>
>
>        <!-- The (asynchronous) donut event provider -->
>        <component
>
>  classname="fr.eventadmin.test.provider.DonutEventProviderImpl"
>                name="donut-event-provider">
>                <!-- Expose the donut provider service -->
>                <provides
>
>  specifications="fr.eventadmin.test.remote.DonutProvider">
>                        <property
>                                name="name"
>                                field="m_name"
>                                value="Unknown donut vendor" />
>                </provides>
>                <!-- Raw events publisher -->
>                <ev:publisher
>                        name="event-publisher"
>                        field="m_publisher"
>                        topics="food/donuts"
>                        synchronous="false" />
>        </component>
>
>        <!-- The synchronous donut event provider -->
>        <component
>
>  classname="fr.eventadmin.test.provider.DonutEventProviderImpl"
>                name="synchronous-donut-event-provider">
>                <!-- Expose the donut provider service -->
>                <provides
>
>  specifications="fr.eventadmin.test.remote.DonutProvider">
>                        <property
>                                name="name"
>                                field="m_name"
>                                value="Unknown donut vendor" />
>                </provides>
>                <!-- Raw events publisher -->
>                <ev:publisher
>                        name="event-publisher"
>                        field="m_publisher"
>                        topics="food/donuts"
>                        synchronous="true" />
>        </component>
>
>        <!-- The (asynchronous) event provider -->
>        <component
>
>  classname="fr.eventadmin.test.provider.AsyncEventProviderImpl"
>                name="event-provider">
>                <!-- Expose the donut provider service -->
>                <provides
>
>  specifications="fr.eventadmin.test.remote.DonutProvider">
>                        <property
>                                name="name"
>                                field="m_name"
>                                value="Unknown donut vendor" />
>                </provides>
>                <!-- Direcly interacts with the Event Admin service -->
>                <requires
>                        field="m_ea" />
>        </component>
>
>        <!-- The synchronous event provider -->
>        <component
>
>  classname="fr.eventadmin.test.provider.SyncEventProviderImpl"
>                name="synchronous-event-provider">
>                <!-- Expose the donut provider service -->
>                <provides
>
>  specifications="fr.eventadmin.test.remote.DonutProvider">
>                        <property
>                                name="name"
>                                field="m_name"
>                                value="Unknown donut vendor" />
>                </provides>
>                <!-- Direcly interacts with the Event Admin service -->
>                <requires
>                        field="m_ea" />
>        </component>
>
>        <!-- Example instances -->
>        <instance
>                component="synchronous-donut-provider"
>                name="Begniers de Pomme">
>                <property
>                        name="name"
>                        value="Begniers de pomme" />
>                <property
>                        name="osgi.remote.interfaces"
>                        value="*" />
>                <property
>                        name="osgi.remote.configuration.type"
>                        value="org.apache.cxf.ws" />
>                <property
>                        name="osgi.remote.configuration.pojo.address"
>                        value="http://localhost:9094/Donut" />
>        </instance>
> </ipojo>
>
> On the iPojo webConsole, i see the "Begniers de Pomme" instance well
> created but
> nothing appears on http://localhost:9094/Donut?wsdl
>
> What's wrong ?
>
> Regards.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Pierre Bourret

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message