camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: Quick questions in CxfConsumer code
Date Fri, 09 Jan 2009 02:42:59 GMT
Hi,

Please see my comments in the mail.
William Tam wrote:
> In doing code cleanup in camel-cxf, I come across a question.  In the
> constructor of CxfConsumer, it tries to assign value to the variable
> bus.  The bus will be used later on to setBus on
> 
>         Bus bus = null;
>         this.endpoint = endpoint;
>         boolean isWebServiceProvider = false;
>         if (endpoint.getApplicationContext() != null) {
>             SpringBusFactory bf = new
> SpringBusFactory(endpoint.getApplicationContext());
>             bus = bf.createBus();
>             if (CxfEndpointUtils.getSetDefaultBus(endpoint)) {
>                 BusFactory.setDefaultBus(bus);
>             }
>         } else {
>             // now we just use the default bus here
>             bus = BusFactory.getDefaultBus();
>         }
>         ServerFactoryBean svrBean = null;
>         ...
>         svrBean.setBus(bus);
> 
> Questions:
> 1) Is the setDefaultBus option only applied to non-Spring CxfEndpoint?
BusFactory.getDefaultBus() will call set the setDefaultBus , if there is
a new bus created.
if (CxfEndpointUtils.getSetDefaultBus(endpoint)) {
    BusFactory.setDefaultBus(bus);
}
This code just helps other CXF components to share the bus with the
Spring camel-cxf endpoint.
> 2) If I add a feature to lookup a bus from the registry/application
> context for non-Spring CxfEndpoint, I would set svrBean to the my bus
> (from the registry) and not getting the default bus.  In this case,
> setDefaultBus option would make sense to non-Spring CxfEndpoint as
> well, right?  And, it means setting my bus as default.
Yes, you may have more than one bus in the registry (which set up by
spring). We should let the use to configure the bus for the no-spring
endpoint. How about add a parameter like the busId in the cxf uri ?
> 3) For Spring CxfEndpoint, does bf.createBus() return the same bus as
> CxfEndpointBean.getBus()?  I guess it may or may not.  You could
> define a bus just for your endpoint, right.  So, would it better to
> take the one from the endpoint bean?
Good question, the original thought of the code is pass the spring
context into the bus. But I think we could update the code to inject the
Application context into the bus which is used by endpoint.
> 
> Thanks,
> William
> 

Cheers,

Willem


Mime
View raw message