Esempio n. 1
0
        public RuleService(IConfigurationRepository configurationRepository,
                           IMonitorRuleRepository monitorRuleRepository,
                           ISqsNotifier sqsNotifier)
        {
            _monitorRuleRepository = monitorRuleRepository;
            _sqsNotifier           = sqsNotifier;

            var sqsConfig = configurationRepository.GetByKey("sqs_notification_config");

            if (sqsConfig == null)
            {
                Logger.Debug("No SQS notification configuration found");
                return;
            }

            try
            {
                _sqsConfiguration = JsonConvert.DeserializeObject <SqsConfiguration>(sqsConfig.Value);
            }
            catch (Exception e)
            {
                Logger.Error(e, "SQS notification configuration is invalid");
                _sqsConfiguration = null;
            }
        }
 public MonitorRuleController(IMonitorRuleRepository monitorRuleRepository)
 {
     _monitorRuleRepository = monitorRuleRepository;
 }