/// <summary> /// Refreshes the discovery info. /// </summary> /// <exception cref="System.Exception"> /// Unable to create Disco Client. /// or /// </exception> public void RefreshCache(string cfg = null) { try { if (String.IsNullOrEmpty(cfg)) { cfg = EcoSpaceUrl; } _optimalEndpoint = null; // var ds = DiscoHelper.CreateReusableDiscoClient(); var ds = DiscoHelper.CreateReusableFaultUnwrappingDiscoClient(cfg); if (ds == null) { throw new Exception("Unable to create Disco Client."); } _cache = ds.GetEndpoints(ContractType); if (!_cache.Any()) { throw new Exception(String.Format("Could not find a service called [{0}].", ContractType)); } } catch (Exception ex) { _logger.Error(ex.GetCombinedMessages()); throw; } }
/// <summary> /// Refreshes the discovery info. /// </summary> public void RefreshCache(string cfg, string contractType) { try { _contractType = contractType; _optimalEndpoint = null; var ds = DiscoHelper.CreateReusableDiscoClient(cfg); if (ds == null) { throw new Exception("Unable to create Disco Client."); } _cache = ds.GetEndpoints(contractType); if (_cache.Count() == 0) { throw new Exception(String.Format("Service [{0}] not available.", contractType)); } } catch (Exception ex) { _logger.Error("Error refreshing cache {0}: {1}", contractType, ex); _logger.Error(ex.GetCombinedMessages()); throw; } }