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