public void Handle(QueueSpy.Messages.BrokerEvent brokerEvent)
        {
            var connectionEstablished = (Messages.ConnectionEstablished)brokerEvent;

            var vhost = dbReader.Get <QueueSpy.VHost> ("Name = :Name", x => x.Name = connectionEstablished.VHostName).FirstOrDefault();

            if (vhost == null)
            {
                return;
            }

            var connectionId = dataWriter.Insert <Executor.Connection> (new Executor.Connection {
                VHostId     = vhost.Id,             // TODO:
                Name        = connectionEstablished.Name,
                Connected   = connectionEstablished.DateTimeUTC,
                IsConnected = true
            });

            foreach (var clientProperty in connectionEstablished.Properties)
            {
                dataWriter.Insert <Executor.ClientProperty> (new Executor.ClientProperty {
                    ConnectionId = connectionId,
                    Key          = clientProperty.Key,
                    Value        = clientProperty.Value
                });
            }
        }
Example #2
0
        public void Handle(QueueSpy.Messages.BrokerEvent brokerEvent)
        {
            var queueDeleted = (Messages.QueueDeleted)brokerEvent;

            dataWriter.Update <Queue>(queueDeleted.QueueId, x => {
                x.Deleted   = queueDeleted.DateTimeUTC;
                x.IsCurrent = false;
            });
        }
Example #3
0
        public void Handle(QueueSpy.Messages.BrokerEvent brokerEvent)
        {
            var connectionLost = (Messages.ConnectionLost)brokerEvent;

            dataWriter.Update <Executor.Connection> (connectionLost.ConnectionId, x => {
                x.IsConnected  = false;
                x.Disconnected = DateTime.UtcNow;
            });
        }
Example #4
0
        public void Handle(QueueSpy.Messages.BrokerEvent brokerEvent)
        {
            var vhostCreated = (Messages.VHostCreated)brokerEvent;

            dataWriter.Insert <Executor.VHost> (new VHost {
                BrokerId = vhostCreated.BrokerId,
                Name     = vhostCreated.Name,
                Active   = true
            });
        }
Example #5
0
        public void Handle(QueueSpy.Messages.BrokerEvent brokerEvent)
        {
            Preconditions.CheckNotNull(brokerEvent, "brokerEvent");
            var queueCreated = (Messages.QueueCreated)brokerEvent;

            var vhost = dbReader.Get <QueueSpy.VHost> ("Name = :Name", x => x.Name = queueCreated.VHostName).FirstOrDefault();

            if (vhost == null)
            {
                return;
            }

            dataWriter.Insert(new Executor.Queue {
                VHostId   = vhost.Id,
                Name      = queueCreated.Name,
                Created   = queueCreated.DateTimeUTC,
                IsCurrent = true
            });
        }
Example #6
0
        public void Handle(QueueSpy.Messages.BrokerEvent brokerEvent)
        {
            var newConsumer = (Messages.NewConsumer)brokerEvent;

            var connection = dbReader.Get <QueueSpy.Connection> ("Name = :Name and IsConnected = TRUE", x => x.Name = newConsumer.ConnectionName)
                             .SingleOrDefault();

            if (connection == null)
            {
                return;
            }

            dataWriter.Insert <Executor.Consumer> (new Executor.Consumer {
                ConnectionId = connection.Id,
                Tag          = newConsumer.Tag,
                QueueName    = newConsumer.QueueName,
                Created      = newConsumer.DateTimeUTC,
                IsConsuming  = true
            });
        }
Example #7
0
        void HandleBrokerEvent(QueueSpy.Messages.BrokerEvent brokerEvent)
        {
            logger.Log(string.Format("Got BrokerEvent {0}", brokerEvent.Description));

            // Very simple initial implementation, just alert on all broker events
            // TODO: Filter on user preferences
            var broker = dbReader.GetById <Broker> (brokerEvent.BrokerId);
            var user   = dbReader.GetById <User> (broker.UserId);

            var alertInfo = new AlertInfo {
                Broker      = broker,
                User        = user,
                AlertType   = AlertTypeFromEventTypeId(brokerEvent.EventTypeId),
                DateTimeUTC = brokerEvent.DateTimeUTC,
                Description = brokerEvent.Description
            };

            foreach (var alertSink in alertSinks)
            {
                alertSink.Handle(alertInfo);
            }
        }
Example #8
0
 public void Handle(QueueSpy.Messages.BrokerEvent command)
 {
     dataWriter.Update <Executor.Broker> (command.BrokerId, x => {
         x.ContactOK = false;
     });
 }
Example #9
0
        public void Handle(QueueSpy.Messages.BrokerEvent brokerEvent)
        {
            var vhostDeleted = (Messages.VHostDeleted)brokerEvent;

            dataWriter.Update <Executor.VHost> (vhostDeleted.VHostId, x => x.Active = false);
        }
Example #10
0
 public void Handle(QueueSpy.Messages.BrokerEvent command)
 {
     InsertEventRecord(command);
     ExecuteBrokerEventHandler(command);
 }
Example #11
0
        public void Handle(QueueSpy.Messages.BrokerEvent brokerEvent)
        {
            var consumerCancelled = (Messages.ConsumerCancelled)brokerEvent;

            dataWriter.Update <Executor.Consumer> (consumerCancelled.ConsumerId, x => x.IsConsuming = false);
        }