public void Handle(DisableEndpointMonitoring message)
        {
            var knownEndpoint = Session.Load <KnownEndpoint>(message.EndpointId);

            if (knownEndpoint == null)
            {
                throw new Exception("No endpoint with found with id: " + message.EndpointId);
            }

            knownEndpoint.Monitored = false;

            Session.Store(knownEndpoint);

            Bus.Publish(new MonitoringDisabledForEndpoint
            {
                EndpointInstanceId = message.EndpointId,
                Endpoint           = knownEndpoint.EndpointDetails
            });
        }
Exemplo n.º 2
0
        public void Handle(DisableEndpointMonitoring message)
        {
            KnownEndpoint knownEndpoint;

            using (var session = store.OpenSession())
            {
                knownEndpoint = session.Load <KnownEndpoint>(message.EndpointId);

                if (knownEndpoint == null)
                {
                    throw new Exception($"No endpoint with found with id: {message.EndpointId}");
                }

                knownEndpoint.Monitored = false;

                session.SaveChanges();
            }

            bus.Publish(new MonitoringDisabledForEndpoint
            {
                EndpointInstanceId = message.EndpointId,
                Endpoint           = knownEndpoint.EndpointDetails
            });
        }