Implementing Durable Functions
1. Implementing Durable Functions
In this video, you'll learn how to implement Durable Functions for stateful workflows.2. What are Durable Functions?
Durable Functions are an extension of Azure Functions that maintain state between executions. Unlike standard functions, they can orchestrate long-running processes, track progress, and manage retries automatically. This makes them ideal for workflows that require multiple steps, complex dependencies, or human interaction over time.3. What are Durable Functions?
For example, an order processing workflow might include inventory checks, payment processing, and shipment scheduling, all coordinated by a single orchestration function.4. Orchestrator Functions
The orchestrator function is the core of Durable Functions. It defines the workflow and calls other activity functions as needed. The orchestrator maintains state, so if a function fails or the system restarts, it can resume from where it left off. You can also visualize orchestrations in the portal to track progress and identify bottlenecks.5. Orchestrator Functions
For instance, a travel booking system might use an orchestrator to coordinate flights, hotels, and car rentals, ensuring that all bookings succeed or compensating actions are triggered if one step fails.6. Activity Functions
Activity functions perform the individual tasks in a workflow. They are stateless and can be retried independently. The orchestrator coordinates these activities, controlling the order and managing dependencies. Activities can be monitored individually to detect slow performance or failures.7. Activity Functions
For example, in a claims processing application, one activity might validate the claim, another calculates the payout, and a third updates the customer database.8. Workflow patterns
Durable Functions support workflow patterns such as chaining multiple activities sequentially, or running multiple activities in parallel and aggregating results. This allows highly scalable workflows and reduces overall execution time for complex operations. Retries and error handling can be configured at the activity level for reliability. For example, an image processing system might run multiple tasks simultaneously to apply different filters to hundreds of images, then combine the results once all tasks complete.9. Human interaction
Durable Functions can also pause workflows and wait for external events, such as approvals or manual input. A loan approval process might wait for a manager to review documents before proceeding, while the orchestrator retains the workflow state safely in the background. This allows workflows to span multiple days or business hours without losing state or requiring manual tracking.10. Monitoring Durable Functions
Azure provides built-in monitoring for Durable Functions, including orchestration history, status tracking, and failure diagnostics. You can visualize workflows, see which activities have completed, and identify bottlenecks. Application Insights can also be used to capture telemetry and provide alerting on failures or long-running activities. For instance, a subscription onboarding process can be monitored to ensure all steps complete correctly, and retries can be triggered automatically if something fails.11. Let's practice!
Now it's your turn to create an orchestration function, chain activities, and observe execution in the portal.Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.