Thanks Andrei!

You're right about 1) but I don't want to make any change to the Service1 
bundle. I found a way adding the META-INF/cxf/bus-extensions.txt to the 
ServerLifeCycleListener/ClientLifeCycleListener bundle. Seems it works but need 
more test.

Xilai
-----Original Message-----
From: Andrei Shakirin [mailto:[email protected]] 
Sent: Monday, July 09, 2012 3:48 PM
To: [email protected]
Subject: RE: How to register ServerLifeCycleListener/ClientLifeCycleListener 
accoss multi cxf bus?

Hi XiLai,

Two things:

1) Up to CXF 2.5.1 to register ServerLifecycleListener in OSGi environment it 
is enough to export OSGi service implemented 
org.apache.cxf.endpoint.ServerLifeCycleListener interface.
In spring it looks like:

    <bean id="serverListener" class="org.mypackage.MyServerListener"/>
    <osgi:service ref=" serverListener "        
interface="org.apache.cxf.endpoint.ServerLifeCycleListener" />

2) If you register service endpoint in another project/bundle and deploy both 
bundles into container, call of your Server Listener will depend on bundles 
startup order: if bundle with server listener is started first, it will be 
called when endpoint from another bundle is registered. Otherwise server 
listener will not be called.
In my case I guaranteed the startup order using OSGi service references.

Regards,
Andrei.

-----Original Message-----
From: XiLai Dai [mailto:[email protected]] 
Sent: 09 July 2012 07:22
To: [email protected]
Subject: How to register ServerLifeCycleListener/ClientLifeCycleListener accoss 
multi cxf bus?

Hi,

There are impls for ServerLifeCycleListener/ClientLifeCycleListener within one 
bundle with spring configuration:

    <bean id="serviceListenerImpl" class="my.ServiceListenerImpl" /> <bean 
id="clientListenerImpl" class="my.ClientListenerImpl" />

And there has a Service1 project which has a jaxws:endpoint with spring 
configuration like this:
<import resource="classpath:META-INF/cxf/cxf.xml"/>

    <jaxws:endpoint id="service1"
        implementor="#Service1Impl"
        address="/service1">
    </jaxws:endpoint>

All these bundles can be deployed into OSGi container. My question will be: 
without modification to Service1 project, how to add the serviceListenerImpl to 
the bus of Service1?

Thanks in advance!
Xilai

Reply via email to