You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by tho huynh ngoc <ng...@gmail.com> on 2016/06/23 15:09:55 UTC

custom conduit CXF

I set a CustomConduitFactory as following

        factory = new JaxWsProxyFactoryBean();
        factory.setServiceClass(Service.class);


        Bus bus = BusFactory.getThreadDefaultBus();
        MyConduitFactory customTransport = new MyConduitFactory();
//described as UDPTransportFactory
        ConduitInitiatorManager extension =
bus.getExtension(ConduitInitiatorManager.class);
        extension.registerConduitInitiator(MyConduitFactory.TRANSPORT_ID,
customTransport);

        factory.setConduitSelector(customTransport);
        factory.setAddress(address);
        client = (Service)factory.create();
        client.send("hi");

It does not work ?

How to declare a custom conduit in CXF client, please ?

I tried to implement a class MyConduit extends AbstractConduit. But i do
not how to declare it in the client implementation
(see  http://cxf.apache.org/docs/custom-transport.html)

Regards,
HNT

RE: custom conduit CXF

Posted by Andrei Shakirin <as...@talend.com>.
Hi,

The registration code is correct.
You need to override AbstractTransportPrefixes.getUriPrefixes() method returning the prefixes of your custom protocol.
Your Conduit will be requested from the factory if client tries to access URL with your custom prefix.

Take as a sample JMS or UDP transport factory: https://github.com/apache/cxf/blob/master/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java 

Regards,
Andrei.

> -----Original Message-----
> From: tho huynh ngoc [mailto:ngocthobkdn@gmail.com]
> Sent: Donnerstag, 23. Juni 2016 17:10
> To: users@cxf.apache.org
> Subject: custom conduit CXF
> 
> I set a CustomConduitFactory as following
> 
>         factory = new JaxWsProxyFactoryBean();
>         factory.setServiceClass(Service.class);
> 
> 
>         Bus bus = BusFactory.getThreadDefaultBus();
>         MyConduitFactory customTransport = new MyConduitFactory();
> //described as UDPTransportFactory
>         ConduitInitiatorManager extension =
> bus.getExtension(ConduitInitiatorManager.class);
>         extension.registerConduitInitiator(MyConduitFactory.TRANSPORT_ID,
> customTransport);
> 
>         factory.setConduitSelector(customTransport);
>         factory.setAddress(address);
>         client = (Service)factory.create();
>         client.send("hi");
> 
> It does not work ?
> 
> How to declare a custom conduit in CXF client, please ?
> 
> I tried to implement a class MyConduit extends AbstractConduit. But i do not
> how to declare it in the client implementation (see
> http://cxf.apache.org/docs/custom-transport.html)
> 
> Regards,
> HNT