Skip to content

Instantly share code, notes, and snippets.

@AnthonyGiretti
Created December 10, 2024 15:20
Show Gist options
  • Save AnthonyGiretti/24f3df0db7d6c77d3ec8bf7e14979723 to your computer and use it in GitHub Desktop.
Save AnthonyGiretti/24f3df0db7d6c77d3ec8bf7e14979723 to your computer and use it in GitHub Desktop.
Example if a DurableClient on .NET 8+ isolated
[Function("FlowCleanupOrchestratorTimeTrigger")]
public async Task Run([TimerTrigger("%FlowCleanupTimeTrigger%", RunOnStartup = true)] TimerInfo myTimer,
[DurableClient] DurableTaskClient client)
{
var instanceId = Guid.NewGuid().ToString();
try
{
_logger.LogInformation($"FlowCleanupOrchestratorTimeTrigger Timer trigger function activated for instanceId: {instanceId}");
await client.ScheduleNewOrchestrationInstanceAsync(nameof(FlowCleanupOrchestrator), new StartOrchestrationOptions(InstanceId: instanceId));
}
catch (Exception ex)
{
_logger.LogError(ex, $"FlowCleanupOrchestratorTimeTrigger: queue trigger function exception for instanceId: {instanceId}. Details: {ex.Message}");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment