0
votes

I believe I conteptually understand what's goind on in Azure Durable Functions. You have to start an Orchestration Function where you can await Activities. When an activity is completed, the Orchestration Function starts from the top, but since the activity now has a result, the result is used instead of invoking it again.

This means the Orchestration Functions 'goes to sleep'. I've been looking into the source of both the Azure Durable Functions and Durable Task Framework on GitHub, but I can't quite find the actual lines of code that impact the callback of the awaited tasks.

Can anyone point me in the right direction?

Thanks!

1

1 Answers

0
votes

I'm no expert on the topic (have been looking into how durable task myself lately) but essentially, the 'sleep' is achieved by scheduling tasks. All durable tasks (orchestrator and activities) are triggered by queue messages and in case of orchestrations, are replayed each time.

Coming to the code, most of this done in the Durable Task framework itself. And for your specific query

  1. Orchestrator Execution runs here, returning any pending orchestration actions
  2. Schedule next steps (activity, timers, etc.) here. The implementation for CompleteTaskOrchestrationWorkItemSync is in on the providers and for Durable Functions, its Azure Storage Queues.

There is no real sleep, but once the orchestration action is completed, another message with the response would trigger the orchestration function, causing it to replay.