Hi This is expected and also by design.
Creating endpoints manually via constructors is not the same as using Camel end users are defining endpoints in the DSL or elsewhere. On Fri, Oct 19, 2018 at 12:08 PM Peter Palaga <[email protected]> wrote: > > Hi *, > > We happen to have a bug in WildFly Camel (WFC), that is caused by a race > between camel-cxf and jboss-ws subsystem both wanting to set > BusFactory.defaultBus and the default thread local bus. > > To fix it, I want to leave jboss-ws to rule the BusFactory and rather > set the CxfRsEndpoint.bus explicitly from our WFC subsystem, so that the > BusFactory defaults broken by jboss-ws are not used. To do that, I was > hoping to use either EndpointStrategy.registerEndpoint(String, Endpoint) > or LifecycleStrategy.onEndpointAdd(Endpoint). > > It turned out that none of the two callbacks is called for endpoints > created by a direct invocation of the CxfRsEndpoint constructor, which I > happened to be using in one of my tests: > > CxfRsComponent cxfConsumerComponent = new CxfRsComponent(camelContext); > CxfRsEndpoint cxfConsumerEndpoint = new > CxfRsEndpoint(CXF_ENDPOINT_BASE_URI, cxfConsumerComponent); > > If I change the above to > > CxfRsEndpoint cxfConsumerEndpoint = camelContext.getEndpoint("cxfrs:" + > CXF_ENDPOINT_BASE_URI, CxfRsEndpoint.class); > > both callback are invoked properly. > > I found no other way how I could set CxfRsEndpoint.bus between the > CxfRsEndpoint creation and the call to CxfRsConsumer.createServer() > where CxfRsEndpoint.bus should be used. > > Is it a known issue that EndpointStrategy.registerEndpoint() and > LifecycleStrategy.onEndpointAdd() are not called for endpoints created > by direct invocation of the endpoint constructor? > > I tend to think that it is a design flaw. Once the API offers the > callbacks it should also guarantee that endpoints cannot avoid those > callbacks. > > If this is really a defect of some sort, I can file a Jira. > > Please utter your opinions. > > Thanks, > > -- Peter > > -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
