Hi Leon, > This design worked as planned for the destination. A problem occurred when > using the same approach for the conduit. I would add features to the client, > and the initialize(Client, Bus) of the feature is triggered. I then attempt > to use > Client.getConduit() so I can set properties on the conduit.
I did not get your use case completely. Conduit is not related with features your adding to client. Conduit and Destination are created using TransportFactory, as described in article. Do you register your own transport factory? Basically call Client.getConduit() invokes Conduit selector which retrieves correct transport factory (based on endpoint url) and ask transport factory for conduit (getConduit() method). > Unfortunately calling Client.getConduit() eventually calls activate() on my > conduit, which results in a null pointer exception. Conduit has prepare() and close() methods. What do you mean with activate()? For more information just look how CXF transports are implemented: org.apache.cxf.transport.jms, org.apache.cxf.transport.local. You can find additional info in my blog: http://ashakirin.blogspot.de/2012/02/custom-cxf-transport.html . Regards, Andrei. > -----Original Message----- > From: Leon Doud [mailto:[email protected]] > Sent: Dienstag, 29. Januar 2013 03:25 > To: [email protected] > Subject: Adding features to a conduit for a custom transport > > I'm implementing a custom transport. I planned to support the transport by > using features to setup the destination and conduit prior to them being > activated. This is based on what I read from http://cxf.apache.org/custom- > cxf-transport.html > > This design worked as planned for the destination. A problem occurred when > using the same approach for the conduit. I would add features to the client, > and the initialize(Client, Bus) of the feature is triggered. I then attempt > to use > Client.getConduit() so I can set properties on the conduit. > Unfortunately calling Client.getConduit() eventually calls activate() on my > conduit, which results in a null pointer exception. > > Here is the stack trace, and the feature is XMPPService (I'm trying to set the > username/password in this case) > at > org.apache.cxf.transport.xmpp.messaging.XMPPConduit.activate(XMPPCon > duit.java:57) > at > org.apache.cxf.transport.AbstractObservable.setMessageObserver(Abstract > Observable.java:48) > at > org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(Abstr > actConduitSelector.java:115) > at > org.apache.cxf.endpoint.UpfrontConduitSelector.selectConduit(UpfrontCon > duitSelector.java:77) > at org.apache.cxf.endpoint.ClientImpl.getConduit(ClientImpl.java:846) > at > org.apache.cxf.transport.xmpp.messaging.XMPPService.initialize(XMPPServi > ce.java:153) > > It seems like I'm in a catch-22. I want to use features to setup the conduit > before it is activated, but trying to use Client.getConduit() activates the > conduit. Is there someway to use Client.getConduit() (from the > implementation of the feature) without activating the conduit? I would > prefer to use features to configure the client/conduit and not the transport > factory. > > Thanks in advance, > Leon
