Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Timeout on CXF Proxy Client

Tags:

jax-ws

cxf

I have a JAX-RS client in CXF created via JAXRSClientFactoryBean.create. How can I set the connection/receive timeouts?

I assume I need to get hold of the conduit but can't work out how to. This project is not using Spring.

like image 888
samblake Avatar asked Jan 09 '15 14:01

samblake


1 Answers

Here's the code I use:

service = JAXRSClientFactory.create(url, serviceClass, providers);
HTTPConduit conduit = WebClient.getConfig(service).getHttpConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setReceiveTimeout(300000); //5 minutes
conduit.setClient(policy);
like image 89
Jason Winnebeck Avatar answered Oct 07 '22 08:10

Jason Winnebeck