Beispiel #1
0
        private async Task OnIsDue(HeartbeatConfiguration configuration, CancellationToken cancellationToken)
        {
            await Mediator.Publish(new OutboundMeasurement()
            {
                Name = "heartbeat",
                Item = new HeartbeatMeasurement()
                {
                    Timestamp = DateTime.UtcNow,
                    Hostname  = System.Net.Dns.GetHostName(),
                },
            });

            await Mediator.Publish(new SensorMeasurement()
            {
                Sensor = "heartbeat",
                Value  = DateTime.UtcNow.ToString("yyyy-MM-ddTHH\\:mm\\:ss.fffffff"),
            }, cancellationToken);

            MeasurementTimingService.ResetDue(configuration);
        }
Beispiel #2
0
 public Heartbeat(IMediator mediator, HeartbeatConfiguration configuration, IMeasurementTimingService measurementTimingService)
 {
     Mediator                 = mediator ?? throw new ArgumentNullException(nameof(mediator));
     Configuration            = configuration ?? throw new ArgumentNullException(nameof(configuration));
     MeasurementTimingService = measurementTimingService ?? throw new ArgumentNullException(nameof(measurementTimingService));
 }