public void Handle(MonitoringDisabledForEndpoint message) { // The user could be disabling an endpoint that had the heartbeats plugin, or not. // Check to see if the endpoint had associated heartbeat. var heartbeat = Session.Load <Heartbeat>(message.EndpointInstanceId); if (heartbeat != null) { if (heartbeat.Disabled) { Logger.InfoFormat("Heartbeat monitoring for endpoint {0} is already disabled", message.EndpointInstanceId); return; } heartbeat.Disabled = true; Session.Store(heartbeat); } else { Logger.InfoFormat("Heartbeat for endpoint {0} not found. Possible cause is that the endpoint may not have the plug in installed.", message.EndpointInstanceId); } StatusProvider.DisableMonitoring(message.Endpoint); Bus.Publish(new HeartbeatMonitoringDisabled { EndpointInstanceId = message.EndpointInstanceId }); }