Durable Functions and Orchestration

Durable Functions and Orchestration

Watch the video to deepen your understanding.

Subscribe

Complete the full lesson to earn 25 points

Work through each section, then tap “Mark as Complete” on the last one.

Section 1 of 4

✦ Skip the page breaks and see fewer ads — read each lesson on a single page with Pro

Lesson: Durable Functions and Orchestration

1. Introduction: Why Durable Functions?

In the world of serverless computing, Azure Functions are excellent for event-driven, short-lived tasks. However, real-world business processes often require stateful workflows—processes that take minutes, hours, or even days to complete.

Standard Azure Functions are stateless; they cannot "remember" where they left off if they time out or if the underlying infrastructure restarts. This is where Durable Functions, an extension of Azure Functions, comes into play.

Durable Functions allow you to write stateful workflows in a serverless environment. They manage state, checkpoints, and restarts automatically, enabling you to build complex orchestrations without having to manage external databases or message queues to track your progress.


2. Core Concepts and Architecture

Durable Functions rely on three primary function types:

  1. Client Functions: The entry point. These functions trigger the orchestration.
  2. Orchestrator Functions: The "brain." They define the workflow logic (the what and the when). They use code to call other functions and must be deterministic.
  3. Activity Functions: The "workers." These perform the actual tasks (e.g., calling an API, querying a database, processing an image).

How it Works: The Replay Pattern

When an Orchestrator function executes, it doesn't just run from start to finish like a normal script. Instead, it uses Event Sourcing. When an activity completes, the orchestrator "replays" its own code from the beginning to rebuild its local state. It ignores activities that have already finished and proceeds to the next step.


Section 1 of 4
PrevNext