Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-8109

Instructions for configuring client programmatically do not survive failover

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Information Provided
    • Affects Version/s: 3.3.3
    • Fix Version/s: None
    • Component/s: Documentation
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport(includingSSLsupport)-Usingjavacode suggests to configure HttpConduit like this:

      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);
      

      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 get hold of Bus instance (we get it from Spring) and make use of HTTPConduitConfigurer extension point:

      bus.setExtension(httpConduitConfigurer, HTTPConduitConfigurer.class);
      

      We use JaxWsProxyFactoryBean for this (it has setBus() method), I'm not sure how to modify the sample in the documentation.

        Attachments

          Activity

            People

            • Assignee:
              reta Andriy Redko
              Reporter:
              neeme Neeme Praks
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: