示例#1
0
 public static void InitializeRuleEngine()
 {
     try
     {
         string   strategyTableStr;
         DateTime time;
         if (MonitorDataAccessor.Instance().IsOpenDbResult)
         {
             MonitorDataAccessor.Instance().GetStrategy(out strategyTableStr, out time);
             RuleEngine.UpdateStrategy(strategyTableStr);
         }
     }
     catch (Exception ex)
     {
         _logService.Error(string.Format("ExistCatch:Error:<-{0}->:{1} \r\n Error detail:{2}", "InitializeRuleEngine", ex.Message, ex.ToString()));
     }
 }
示例#2
0
        internal static void ExecuteCommand(Command command)
        {
            try
            {
                if (command.Target == TargetType.ToRuleEngine && command.Code == CommandCode.UpdateStrategy)
                {
                    RuleEngine.UpdateStrategy(command);
                }

                foreach (var ds in _dataSources)
                {
                    if (command.Target == TargetType.ToDataSource || command.Target == TargetType.ToAll)//&& command.Target == ds.Name
                    {
                        ds.ExecuteCommand(command);
                    }
                }

                foreach (DataService service in innerServiceCollection.Where(i => !i.IsInterrupted))
                {
                    try
                    {
                        if (command.Target == TargetType.ToClient || command.Target == TargetType.ToAll)//&& command.Target == service.Name
                        {
                            service.Client.ReceiveCommand(command);
                        }
                    }
                    catch (Exception ex)
                    {
                        service.IsInterrupted = true;
                        service.Exception     = ex;
                    }
                }
            }
            catch (Exception ex)
            {
                _logService.Error(string.Format("ExistCatch:Error:<-{0}->:{1} \r\n Error detail:{2}", "ExecuteCommand", ex.Message, ex.ToString()));
            }
        }