我有一個cxf JAX-WS客戶端。我添加了故障轉移策略。問題是客戶端如何從備份解決方案中恢復並再次使用主URL?因爲現在在客戶端切換到輔助URL之後,即使再次可用,也不會使用主URL。cxf故障轉移恢復
爲客戶端部分中的代碼是:
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(GatewayPort.class);
factory.setAddress(this.configFile.getPrimaryURL());
FailoverFeature feature = new FailoverFeature();
SequentialStrategy strategy = new SequentialStrategy();
List<String> addList = new ArrayList<String>();
addList.add(this.configFile.getSecondaryURL());
strategy.setAlternateAddresses(addList);
feature.setStrategy(strategy);
List<AbstractFeature> features = new ArrayList<AbstractFeature>();
features.add(feature);
factory.setFeatures(features);
this.serviceSoap = (GatewayPort)factory.create();
Client client = ClientProxy.getClient(this.serviceSoap);
if (client != null)
{
HTTPConduit conduit = (HTTPConduit)client.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setConnectionTimeout(this.configFile.getTimeout());
policy.setReceiveTimeout(this.configFile.getTimeout());
conduit.setClient(policy);
}
在年底選擇其他的辦法:自定義機制將數據發送到輔助URL。例如:嘗試2次發送到第一個URL,如果發送到第二個URL失敗。 (由於來自URL提供者的新信息的業務模型更改,添加了此方法) – adimoldovan