public async Task RunOrchestrator([OrchestrationTrigger] IDurableOrchestrationContext context, ILogger log) { log.LogInformation($"Running drink reminder function ..."); var userId = context.GetInput <string>(); log.LogInformation($"Got user {userId} "); await this.monitoringRepository.DeleteAsync(userId); log.LogInformation($"Waiting for next drink to occur."); await context.CreateTimer(DateTime.UtcNow.AddHours(1), CancellationToken.None); var notification = new DrinkReminderNotification(userId); await notificationService.NotifyAsync(new[] { notification }); log.LogInformation($"Terminating monitoring instance for user {userId}"); }
private async Task <NotificationMessage> BuildNotificationMessageAsync(string language, DrinkReminderNotification reminder) { var title = await translationService.GetTranslationAsync(language, "DrinkReminder"); var body = await translationService.GetTranslationAsync(language, "DrinkReminderMessage"); return(new NotificationMessage(title, body)); }