Example #1
0
        public AlertEventProcessor(IAlertingConfiguration config, IActionStore dal)
        {
            this.dal      = dal;
            configuration = config;
            var factory = new ConnectionFactory()
            {
                HostName = configuration.MessageQueueHost, UserName = configuration.MessageQueueUserName, Password = configuration.MessageQueuePassword
            };

            connection = factory.CreateConnection();
            channel    = connection.CreateModel();

            channel.QueueDeclare(queue: config.EventListenerQueueName,
                                 durable: true,
                                 exclusive: false,
                                 autoDelete: false,
                                 arguments: null);

            channel.BasicQos(prefetchSize: 0, prefetchCount: 1, global: false);

            var consumer = new EventingBasicConsumer(channel);

            consumer.Received += (source, ea) => {
                OnRequestReceived(ea);
            };

            channel.BasicConsume(queue: config.EventListenerQueueName,
                                 autoAck: false,
                                 consumer: consumer);
        }
Example #2
0
        public CommandProcessor(IAlertingConfiguration configuration, IActionStore dal)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            if (dal == null)
            {
                throw new ArgumentNullException("dal");
            }

            this.configuration = configuration;
            this.dal           = dal;
        }