public async Task Handle(MonitoringEnabledForEndpoint domainEvent) { var id = DeterministicGuid.MakeId(domainEvent.Endpoint.Name, domainEvent.Endpoint.HostId.ToString()); using (var session = store.OpenAsyncSession()) { var knownEndpoint = await session.LoadAsync <KnownEndpoint>(id) .ConfigureAwait(false); if (knownEndpoint == null) { knownEndpoint = new KnownEndpoint { Id = id, EndpointDetails = domainEvent.Endpoint, HostDisplayName = domainEvent.Endpoint.Host }; await session.StoreAsync(knownEndpoint).ConfigureAwait(false); } knownEndpoint.Monitored = true; await session.SaveChangesAsync() .ConfigureAwait(false); } }
public async Task Handle(HeartbeatingEndpointDetected domainEvent) { var endpoint = domainEvent.Endpoint; var id = DeterministicGuid.MakeId(endpoint.Name, endpoint.HostId.ToString()); using (var session = store.OpenAsyncSession()) { var knownEndpoint = await session.LoadAsync <KnownEndpoint>(id) .ConfigureAwait(false); if (knownEndpoint == null) { knownEndpoint = new KnownEndpoint { Id = id, EndpointDetails = endpoint, HostDisplayName = endpoint.Host, Monitored = true }; await session.StoreAsync(knownEndpoint).ConfigureAwait(false); } else { knownEndpoint.Monitored = monitoring.IsMonitored(id); } await session.SaveChangesAsync() .ConfigureAwait(false); } }
public void Handle(HeartbeatingEndpointDetected domainEvent) { var id = DeterministicGuid.MakeId(domainEvent.Endpoint.Name, domainEvent.Endpoint.HostId.ToString()); using (var session = store.OpenSession()) { var knownEndpoint = new KnownEndpoint { Id = id, EndpointDetails = domainEvent.Endpoint, HostDisplayName = domainEvent.Endpoint.Host, Monitored = monitoring.IsMonitored(id) }; session.Store(knownEndpoint); session.SaveChanges(); } }
public async Task Handle(HeartbeatingEndpointDetected domainEvent) { var id = DeterministicGuid.MakeId(domainEvent.Endpoint.Name, domainEvent.Endpoint.HostId.ToString()); using (var session = store.OpenAsyncSession()) { var knownEndpoint = new KnownEndpoint { Id = id, EndpointDetails = domainEvent.Endpoint, HostDisplayName = domainEvent.Endpoint.Host, Monitored = monitoring.IsMonitored(id) }; await session.StoreAsync(knownEndpoint) .ConfigureAwait(false); await session.SaveChangesAsync() .ConfigureAwait(false); } }
public void Handle(MonitoringDisabledForEndpoint domainEvent) { var id = DeterministicGuid.MakeId(domainEvent.Endpoint.Name, domainEvent.Endpoint.HostId.ToString()); using (var session = store.OpenSession()) { var knownEndpoint = session.Load <KnownEndpoint>(id); if (knownEndpoint == null) { knownEndpoint = new KnownEndpoint { Id = id, EndpointDetails = domainEvent.Endpoint, HostDisplayName = domainEvent.Endpoint.Host, }; session.Store(knownEndpoint); } knownEndpoint.Monitored = false; session.SaveChanges(); } }