public async Task Handle(TimingCommand alertCommand, CancellationToken cancellationToken) { await _notifier.NotifyAsync(alertCommand.Message, alertCommand.IsAlarm); _alertCommandRepository.RemoveCommand(alertCommand.Id); alertCommand.AfterRun(); if (!alertCommand.IsComplete) { _alertCommandRepository.AddCommand(alertCommand); } _logger.LogInformation($"ID:{alertCommand.Id} is handled and its complete status is {alertCommand.IsComplete}"); }
public Task Handle(DeleteCommand notification, CancellationToken cancellationToken) { var cmd = _repository.Find(notification.Id); if (cmd != null) { _repository.RemoveCommand(notification.Id); _messenger.SendMessage(notification.Id, "The command deleted"); } return(Task.CompletedTask); }