Created
December 10, 2024 15:20
-
-
Save AnthonyGiretti/24f3df0db7d6c77d3ec8bf7e14979723 to your computer and use it in GitHub Desktop.
Example if a DurableClient on .NET 8+ isolated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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