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
                });
            }
        }
        public void Should_be_able_to_insert_a_user()
        {
            var user = new User {
                Email        = "*****@*****.**",
                PasswordHash = "blah",
                Salt         = "foo"
            };

            var id = dataWriter.Insert(user);

            Console.WriteLine(id);

            dataWriter.Delete <User> (id);
        }
 public void Handle(QueueSpy.Messages.NewWebhook command)
 {
     dataWriter.Insert(new Executor.Webhook {
         Url    = command.Url,
         UserId = command.UserId
     });
 }
Exemple #4
0
 public void Handle(QueueSpy.Messages.Alert command)
 {
     dataWriter.Insert(new Executor.Alert {
         BrokerId    = command.BrokerId,
         AlertTypeId = command.AlertTypeId,
         Description = command.Description,
         DateTimeUTC = command.DateTimeUTC
     });
 }
Exemple #5
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
            });
        }
Exemple #6
0
 public void Handle(QueueSpy.Messages.QueueLevel command)
 {
     dataWriter.Insert(new Executor.QueueLevel {
         QueueId   = command.QueueId,
         Ready     = command.Ready,
         Unacked   = command.Unacked,
         Total     = command.Total,
         SampledAt = command.SampledAt
     });
 }
Exemple #7
0
        public void InsertEventRecord(Messages.BrokerEvent command)
        {
            var brokerEvent = new QueueSpy.Executor.BrokerEvent {
                BrokerId    = command.BrokerId,
                EventTypeId = command.EventTypeId,
                DateTimeUTC = command.DateTimeUTC,
                Description = command.Description
            };

            dataWriter.Insert(brokerEvent);
        }
        public void Handle(QueueSpy.Messages.RegisterBroker command)
        {
            var broker = new Broker {
                UserId   = command.UserId,
                Url      = command.Url,
                Username = command.Username,
                Password = command.Password,
                Active   = true
            };

            dataWriter.Insert(broker);
        }
        public void Handle(RegisterUser registerUser)
        {
            var hashResult = passwordService.Hash(registerUser.Password);

            var user = new User {
                Email        = registerUser.Email,
                PasswordHash = hashResult.PasswordHash,
                Salt         = hashResult.Salt
            };

            dataWriter.Insert(user);

            mailerService.Email(registerUser.Email, "Welcome to QueueSpy", "Welcome to QueueSpy (better intro message to follow :)");
        }
Exemple #10
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
            });
        }
Exemple #11
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
            });
        }