简体   繁体   中英

Timer triggered Durable function schedule

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?

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>>");
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM