public async Task Run([TimerTrigger("%MorningAlertCron%")] TimerInfo myTimer, ILogger log, CancellationToken cancellationToken) { log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); var command = new GetProfilesInQuarantineQuery(); var profiles = await mediator.Send(command, cancellationToken); foreach (var profile in profiles) { var notificationCommand = new SendMorningAlertNotificationCommand(profile, ""); await mediator.Send(notificationCommand, cancellationToken); } }
public async Task Run([TimerTrigger("%MorningAlertCron%")] TimerInfo myTimer, ILogger log, CancellationToken cancellationToken) { log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); var command = new GetProfilesInQuarantineQuery(); var profiles = await mediator.Send(command, cancellationToken); foreach (var profile in profiles) { var notificationCommand = new SendMorningAlertNotificationCommand(profile, Environment.GetEnvironmentVariable("MorningAlertNotificationMessage") ?? "Staying quarantined is safer for you and for the ones you love, stay safe."); await mediator.Send(notificationCommand, cancellationToken); } }
public async Task <IEnumerable <Profile> > Handle(GetProfilesInQuarantineQuery request, CancellationToken cancellationToken) { return(await repository.GetRawProfilesInQuarantineAsync(cancellationToken)); }