Пример #1
0
 public static void Start()
 {
     ConfigWebServiceUrl = ConfigurationManager.AppSettings["FxConfigServiceUrl"];
     if (string.IsNullOrWhiteSpace(ConfigWebServiceUrl))
     {
         ConfigWebServiceUrl = null;
         CommonUtils.Log.Log(LogLevelEnum.Fatal, "No FxConfigWebService setting is found in appSettings.", new Dictionary <string, string>().AddLogTagData("FXD303029"));
     }
     else
     {
         ConfigWebServiceUrl          = ConfigWebServiceUrl.Trim();
         _chystrixConfigWebServiceUrl = ConfigWebServiceUrl.WithTrailingSlash() + "ServiceConfig/ConfigInfoes/Get/921807";
         if (_timer == null)
         {
             SyncFXConfigWebServiceSettings();
             string str = SyncSOAServiceUrl("CHystrixRegistryService", "http://soa.ant.com/framework/soa/chystrix/registryservice/v1");
             if (!string.IsNullOrWhiteSpace(str))
             {
                 HystrixCommandBase.RegistryServiceUrl = str;
             }
             Timer timer = new Timer {
                 Interval  = 600000.0,
                 AutoReset = true,
                 Enabled   = true
             };
             _timer          = timer;
             _timer.Elapsed += new ElapsedEventHandler(HystrixConfigSyncManager.SyncConfig);
         }
     }
 }
Пример #2
0
        public static void Start()
        {
            ConfigWebServiceUrl = ConfigurationManager.AppSettings[ConfigWebServiceSettingKey];
            if (string.IsNullOrWhiteSpace(ConfigWebServiceUrl))
            {
                ConfigWebServiceUrl = null;
                CommonUtils.Log.Log(LogLevelEnum.Fatal, "No FxConfigWebService setting is found in appSettings.",
                                    new Dictionary <string, string>().AddLogTagData("FXD303029"));
                return;
            }
            else
            {
                ConfigWebServiceUrl = ConfigWebServiceUrl.Trim();
            }

            _chystrixConfigWebServiceUrl = ConfigWebServiceUrl.WithTrailingSlash() + ConfigWebServiceUrlSuffix;

            if (_timer != null)
            {
                return;
            }

            SyncFXConfigWebServiceSettings();
            string hystrixRegistryServiceUrl = SyncSOAServiceUrl(CHystrixRegistryServiceName, CHystrixRegistryServiceNamespace);

            if (!string.IsNullOrWhiteSpace(hystrixRegistryServiceUrl))
            {
                HystrixCommandBase.RegistryServiceUrl = hystrixRegistryServiceUrl;
            }

            _timer = new Timer()
            {
                Interval  = SyncConfigIntervalMilliseconds,
                AutoReset = true,
                Enabled   = true
            };
            _timer.Elapsed += new ElapsedEventHandler(SyncConfig);
        }