Using Azure Functions, we can quickly develop and deploy small pieces of code in the Azure Cloud environment. We can create the functions using any language or environment as per our choice. During the development of processes, we do not need to consider the building of an application or the infrastructure configuration. The function's runtime is always associated with the hosting and scaling of our code as events or Triggers, which can be an HTTP request or any other types like timers, messages, database-related, etc.
What is a Durable Function?
Azure Durable Functions act as an extension of the Azure Function, which helps us operate long-lasting, stateful operations in the Azure environment. With the help of Durable functions, we can implement the state in the Azure Functions stateless pattern. By default, Azure maintains the infrastructure to support the information related to the state. Therefore, we can use the Durable Functions to implement the long-running workflow. In this way, we can use the benefit of the serverless hosting model. The Durable Functions framework manages the activity monitoring, synchronization, and run time issues. Duration Functions help us implement the complicated stateful process in a serverless environment.
In other words, the Azure Durable Function behaves like an extended version of the Azure Function. Using Azure Durable functions, we can develop a stateful function-based workflow in a serverless environment. We can build this stateful workflow by using different types of functions which perform various types of activities, and this type of function is known as the orchestrator function. The azure function is always considered a Software Switch since it takes data from the input parameters, processes the data, and performs the appropriate action. In the case of Durable Function, instead of using a single function as a switch, it always takes a series of functions and acts as a single unit, then builds in the workflow to manage the actions and handling waits pausing the function for the final decision.
One of the significant benefits of the Azure function is its consumption-based or per-second-based costing model. It means we need to pay only for what we use. The same model also carries into the Durable Functions. Here also, we charged when the workflow was running. However, there is no charge calculated if the workflow is paused for waiting for some input data. When the workflow is broken, Durable Functions holds its state externally so that once the workflow is again started, it can pick up the state value and carry on the process.
Why are Durable Functions required?
So, before discussing the Durable functions application patterns, first, we need to understand the importance of the Azure Durable Functions. Then, this section will discuss the different advantages of the Azure Durable Functions.
- With the help of Azure Durable Functions, we can develop an event-driven mechanism. The Durable function can wait asynchronously for different external events during the execution process. Then, after that external event, it can perform a series of tasks related to that particular event.
- In the Durable function, we can define our workflow in the code. In this process, we can understand the entire picture of what workflow will do. For this, we do not require to analyze the multiple functions.
- If the workflow contains any multi-step tasks or events, then there is a probability that some of the functions need to be executed in parallel. So, with the help of Durable Function frameworks, we can quickly implement the fan-in part of a fan-out-fan-in pattern. So, in Durable functions, parallel running events implementation can do easily, and also, we can perform the scale-out to bring the potential for speedup of the system.
- In process workflow, sometimes we need to wait for the execution of some external events or responses by the users or any external system to perform the following operation like sending or processing information. But the, at the time, we need to maintain some time interval that related response must be received within the mentioned time duration. Using Durable Functions, we can implement this type of functionality directly. It detects that the mentioned orchestration has stopped due to some operational response. It can also take some action to move it again or send an alert to the system administrator related to that delay.
- With the help of Durable Functions, we can easily manage the workflow states for us. We can implement complex workflows without using any database to maintain the shape. For example, if we want to use the database, we can use it to update the state of our business entities for tracking purposes. But we do not need to manage the state of the orchestration process in the database. The Durable Functions can handle it on its own.
- In Durable Functions, we can find out the current state of the workflow processing by using the query status API. These APIs helps us to identify whether the orchestration is still running condition or not. Also, the query status API provides the showHistory flag, which provides the history of the workflow. It can help us identify where it got up before it struck or failed.
- As the Durable Functions developed on top of the existing Azure Function models, we can benefit from the serverless pricing model. First, however, we need to pay for the time when our functions are running. Also, our orchestration functions invocations will be a rapid process to wake up, decide what next step in the workflow to execute, and go back to sleep mode until the next step is not completed.
- Finally, developing and testing the entire workflow in the local environment is possible before deploying it on the cloud for Durable Functions. We can use the whole debugging experience of stepping through the orchestration and activity functions. Also, after the workflow publishes for the Azure Cloud, we can use the Application Insights Integration, which provides us access to Function App telemetry and logs.
Duration Functions Application Patterns
We can divide the Azure Durable Functions into three different function types,






Swesh SPosted May 12, 2022, 4:05 PM
Fantastic!
Vinay AyinapurapuPosted May 5, 2022, 6:56 PM
Very good article debasish