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?
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.
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?

Thanks,
William

Reply via email to