Stateful Serverless with Durable Functions

Implement complex, long-running workflows in serverless using Durable Functions — covering Function Chaining, Fan-out/Fan-in, and the Async HTTP API pattern.

# Stateful Serverless with Durable Functions *This article is Part 1, Chapter 1.3 of the **AZ-204 Exam Refresher** series. We extend our Azure Functions knowledge to cover Durable Functions — the framework for orchestrating long-running, stateful workflows without managing servers or queues manually.* --- ## Introduction Standard Azure Functions have a problem: they're stateless and time-limited. What happens when you need to process a multi-step order — verify payment, reserve inventory, dispatch shipping, send confirmation — where each step could fail independently and the whole thing might take minutes? You could try to chain regular functions with queues yourself, but you'd spend more time writing retry logic and state checkpointing than actual business logic. **Durable Functions** is Azure's answer: a framework that lets you write imperative orchestration code while the runtime handles state persistence, retries, and replay transparently. The magic ingredient is the **orchestrator function** — it's replayed from the beginning on every event, but because all async calls are checkpointed, the replay is fast and side-effect-free. --- ## Core Concepts ### The Three Function Types Durable Functions introduces three specialized function roles: | Role | What It Does | |---|---| | **Orchestrator** | Defines the workflow. Calls activity functions, waits for events, handles branching. Must be deterministic. | | **Activity** | Does the actual work (DB calls, HTTP request