0

I am currently building an azure durable function for my organization. The requirement is to run this orchestration every weekday during midnight. With eternal functions we can only provide a delay. How can I achieve this goal through a cron expression as such?

Can I create a Timer triggered Durable function? Is there any limitation? Or should I create a HTTP Triggered durable function in which the orchestrator waits for an external event; and then have a normal timer trigger azure function raise that event according to the Cron expression?

TylerH
  • 20,799
  • 66
  • 75
  • 101
  • Yes, you can create a timer triggered durable function with require corn expression to run midnight every weekday. – user1672994 Jul 10 '22 at 13:21
  • But the [link](https://stackoverflow.com/questions/55704894/does-azure-durable-function-support-cron-jobs) here says we cant have a cron expression. I assume it signifies that we cant have timer triggered durable function. Is my understanding correct? – Pramod J C Jul 11 '22 at 04:19
  • Yes, you can create the timer durable function. I've posted the sample as answer. – user1672994 Jul 11 '22 at 04:52

1 Answers1

1

You can define timer-triggered function with DurableOrchestrationClient input binding. Please see below sample declaration:

[FunctionName("TimerDurableFunctionStarter")]
public static async Task Run(
    [TimerTrigger("0 */1 * * * *")] TimerInfo info,
    [DurableClient] IDurableOrchestrationClient timerDurableOrchestratorStarter)
{
   string instanceId = await timerDurableOrchestratorStarter.StartNewAsync("<<OrchestratorFunctionName>>");
}
user1672994
  • 10,509
  • 1
  • 19
  • 32