First face-off: Azure Durable Functions

Dariusz Parzygnat
Serverless Guru
Published in
3 min readDec 12, 2019

It’s clear that managing state in a serverless environment is hard. However, Durable Functions comes to the rescue! Durable Functions is an extension of Azure Functions and it allows you to easily pass a state between functions. So now you can create complex workflows with many functions. Moreover, Durable Functions manages checkpoints and restarts and gives you a chance to handle exceptions in an approachable manner.

Image: Pixabay

What are the essential elements?

The entire definition of Durable Functions is always created in code, meaning that you don’t need an extra description language, e.g. YAML, JSON, etc., to get started. However, you have to know these three types of functions that are to describe your workflow.

  • Client function
    This is a common function with one of the available triggers, e.g. HTTP trigger, Queue storage trigger, etc. Using a durable client output binding makes the function a specific one. This function is used to start a new instance of orchestration and thanks to the durable client, it is possible to return an orchestration status to a caller.
Client function triggered by HttpRequest
  • Orchestrator function
    This is the heart of Durable Functions. Using this function you can define execution order, setup exceptions handling and deal with a state.
Orchestrator function with described workflow
  • Activity function
    The main goal of the activity function is to get a job done. You can use it to calculate something and to get any information from external sources. Moreover, it accepts an input parameter that is passed from an orchestrator function. After a task is done, you can return a value that is further processed by an orchestrator function.
Two activity functions with different responsibilities

There is one more called an ‘entity function’. It defines operations for reading and updating a small piece of state. Entity function is only available in Durable Functions 2.0 and above. Because of that, we will cover it in the next article.

What languages does it support?

Currently, Durable Functions supports C#, F#, JavaScript. Moreover, the goal of the Azure Functions team is to cover all available languages within Azure Functions so, you can expect that Durable Functions will be available for languages like Python, Java, etc. sooner or later.

Summary

If you need to describe a workflow, don’t hesitate to use Durable Functions. It is one of the best options to pass a state between functions and it allows you to stay where you fell the best — in code. Once you use it, you will always see new use cases. If you are not sure if your architecture is good or you have a problem with starting, call us. We, at Serverless Guru, are here to help you.

Dariusz Parzygnat

Founder — Serverless Wroclaw

LinkedIn — @dariuszparzygnat

Twitter — @dariusparzygnat

Thanks for reading 😃

If you would like to learn more about Serverless Guru, please follow us on Medium, Twitter, Instagram, Facebook, or LinkedIn!

--

--

Dariusz Parzygnat
Serverless Guru

Serverless enthusiast, organizer of Serverless Wroclaw Meetup, “Serverless on platform Azure” book author. Twitter: @dariusparzygnat