You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Neeme Praks (Jira)" <ji...@apache.org> on 2019/09/05 11:58:00 UTC
[jira] [Updated] (CXF-8109) Instructions for configuring client
programmatically do not survive failover
[ https://issues.apache.org/jira/browse/CXF-8109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Neeme Praks updated CXF-8109:
-----------------------------
Description:
[http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport(includingSSLsupport)-Usingjavacode] suggests to configure HttpConduit like this:
{code:java}
Client client = ClientProxy.getClient(greeter);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(36000);
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setReceiveTimeout(32000);
http.setClient(httpClientPolicy);
{code}
While this works initially, it fails as soon as a failover happens. During failover, existing {{HttpConduit}} is disposed and new one is created. The policy and other settings are not copied from old conduit to new one (we found out the hard way, in production).
Instead, one should use get hold of {{Bus}} instance (we get it from Spring) and make use of {{HTTPConduitConfigurer}} extension point:
{code:java}
bus.setExtension(httpConduitConfigurer, HTTPConduitConfigurer.class);
{code}
We use {{JaxWsProxyFactoryBean}} for this (it has {{setBus()}} method), I'm not sure how to modify the sample in the documentation.
was:
[http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport(includingSSLsupport)-Usingjavacode] suggests to configure HttpConduit like this:
{code:java}
Client client = ClientProxy.getClient(greeter);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(36000);
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setReceiveTimeout(32000);
http.setClient(httpClientPolicy);
{code}
While this works initially, it fails as soon as a failover happens. During failover, existing {{HttpConduit}} is disposed and new one is created. The policy and other settings are not copied from old conduit to new one (we found out the hard way, in production).
Instead, one should use get hold of {{Bus}} instance (we get it from Spring) and make use of {{HTTPConduitConfigurer}} extension point:
{code:java}
bus.setExtension(httpConduitConfigurer, HTTPConduitConfigurer.class);
{code}
We use {{JaxWsProxyFactoryBean}} for this (it has {{setBus()}} method), I'm not sure how to modify the sample in the documentation.
{{}}
> Instructions for configuring client programmatically do not survive failover
> ----------------------------------------------------------------------------
>
> Key: CXF-8109
> URL: https://issues.apache.org/jira/browse/CXF-8109
> Project: CXF
> Issue Type: Bug
> Components: Documentation
> Affects Versions: 3.3.3
> Reporter: Neeme Praks
> Priority: Minor
>
> [http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport(includingSSLsupport)-Usingjavacode] suggests to configure HttpConduit like this:
> {code:java}
> Client client = ClientProxy.getClient(greeter);
> HTTPConduit http = (HTTPConduit) client.getConduit();
>
> HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
>
> httpClientPolicy.setConnectionTimeout(36000);
> httpClientPolicy.setAllowChunking(false);
> httpClientPolicy.setReceiveTimeout(32000);
>
> http.setClient(httpClientPolicy);
> {code}
> While this works initially, it fails as soon as a failover happens. During failover, existing {{HttpConduit}} is disposed and new one is created. The policy and other settings are not copied from old conduit to new one (we found out the hard way, in production).
> Instead, one should use get hold of {{Bus}} instance (we get it from Spring) and make use of {{HTTPConduitConfigurer}} extension point:
> {code:java}
> bus.setExtension(httpConduitConfigurer, HTTPConduitConfigurer.class);
> {code}
> We use {{JaxWsProxyFactoryBean}} for this (it has {{setBus()}} method), I'm not sure how to modify the sample in the documentation.
--
This message was sent by Atlassian Jira
(v8.3.2#803003)