Durable Function is an extension of Azure Functions which allows us to write stateful functions in serverless computing environments. It facilitates users to define stateful workflows by writing the orchestrator workflow.
The orchestrator function provides you with more control for building workflows in comparison to a designer for Microsoft Flow or Logic Apps.
Durable Functions vs Logic Apps
Users can run a business workflow in Azure using the Logic App services. Moreover, Logic App is a logical container for one workflow where the user can define using triggers and actions. The trigger instantiates a workflow, which consists of one or many activities (actions). For instance, a user can trigger a workflow by sending an HTTP request or schedule a workflow every hour to retrieve data from a public website. The latter is a natural, straightforward, and excellent use-case for a Logic App when you need to process the data and persist it in a database in Azure such as Cosmos DB.
With Azure Durable Functions, user can write stateful workflows in a new function type called an orchestrator function. This orchestration function provides more control for building workflows than using, for instance, a designer for Microsoft Flow or Logic Apps.
The critical difference with Logic Apps and Durable Functions is user can write code and have fewer restrictions in the later. With Logic Apps, the user is being bound to triggers and actions it provides. The action offers a wide variety of flow control, connectivity, behavior, and message handling, but still less flexibility than with code.
To know more check, Durable Functions or Logic Apps – Serverless360
Key Concepts of the Azure Durable Functions
Utilizing the Azure Durable Functions would require a clear understanding of the concepts below
- The Orchestrator Client
- The Orchestrator Function
- The Activity Function
- Checkpoints and replays
This blog “Introduction to Azure Durable Functions” can help acquire more knowledge on the key concepts.
Types of Triggers in Azure Durable Functions
- Durable Functions HTTP starter trigger
- Durable Functions activity triggers
- Durable Functions orchestrator trigger
Durable Functions HTTP starter trigger gets triggered whenever it receives an HTTP request to perform the orchestration.
Durable Functions activity triggers run whenever the activity is addressed by an orchestration function.
Durable Functions orchestrator trigger is an orchestrator function that invokes activity function in a sequence
Managing Durable Functions – Solutions with Serverless360
Using the Serverless360 portal, user can manage and monitor the Azure Durable Functions effectively. If the user is shipping a function to maintenance the major concern would be on operations like enable/disable, testing the function, accessing invocation logs, invoke functions, managing keys, etc. Let’s look how Serverless360 deals with such requirements effectively.
To start off with, the user can associate the Function App containing the Durable Function to the appropriate Composite Application to rightly represent the business context. Once associated, the user can navigate to the list of functions and perform bulk operations for disabling or enabling function. This operation can also be done directly by the enable or disable option provided.
An Azure Function may hold several functions or durable functions, it is now possible to test Azure Functions right from the Serverless360 portal. This reduces time spent on switching between portals.
User can not only access the invocation logs but also filter them to locate the specific record. It is also possible to get the details of an invocation by clicking on the Invocation ID.
The user can be rest assured regarding the security, by creating keys at the Function level. If there is a key created for a Function, then the Function expects the key to behave as a header to authorize any Http request. If no key is created, then Http requests do not require any authorization. Serverless360 now provides the capability to manage keys at the Function level.
Azure Function supports different types of triggers like Http, Service Bus Queue, Timer, etc. There may be scenarios where an invocation of the Function fails, and the user needs to revoke it. There is no possibility to do it rather than posting the message of the failed invocation to the Trigger of the Function (this is not feasible in Timer triggered Function). Serverless360 provides the capability to invoke the Function by sending a message to the Trigger. The User can achieve this by providing the Trigger details in the Invoke Function screen and by sending the message. For instance, if the Function is a Service Bus Queue triggered, the user can provide the Queue connection details and post the message. In good order, the Triggers supported in Serverless360 are Service Bus Queue, Service Bus Topic, Event Grid and Http.
In-Addition to the Composite Application dashboard Serverless360 also provides Function App Default dashboards for each Function App associated with the Composite Application. In each default dashboard, the user can view the default widgets with the following key metrics being highlighted.
- Function Execution Count
- Data Out
- Data In
- Function Execution Units
- Average Response Time
- Http Errors
All these widgets are plotted for 7 days by default. Users can modify these widgets based on their requirements. All the operational capabilities available on the Composite Application dashboard are possible here as well.
Azure Durable Function App Monitoring
Serverless360 offers a range of monitors to facilitate monitoring Azure Durable functions both at the function level and at the Function App level. Let us explore the various monitoring solutions from Serverelss360 to achieve extensive monitoring of Azure Durable Functions.
Azure Durable Function App State Monitoring
Serverless360 owns exceptional monitoring capabilities that keep the users informed about the health status and functionality of the resources. If the user wants to monitor the status of the Durable Functions state, they can make use of
- Threshold monitor
- Status Monitor
Monitoring Durable Functions State Using Threshold Monitor
If the intention is to monitor the state, say the business demands the Function App, that handles the critical computation to be always running. At such circumstances, Serverless360 can monitor the current state of the Function App against the expected state.
Monitoring Durable Functions State Using Status Monitor
Many Business solutions are orchestrated using Azure Serverless components like Service Bus Queues, Logic Apps, and Function Apps. The monitoring requirement here is to get a status update on all the entities at every one-hour interval. Status Monitor provides complete health monitoring where the user can view the status of entities at specific time intervals.
Monitor Azure Functions Based on the Metrics
Data Monitoring can be configured for an Azure Function App to carry out monitoring based on an extensive set of metrics. If the requirement is to monitor any errors encountered by the Azure Function App that makes it unavailable for the consuming application, then configure a data monitor with Http Server Errors being monitored against appropriate warning and error threshold values.
Monitor Azure Durable Functions for Failure
To receive alerts when any function gets failed the best solution in Serverless360 will be the Watch Monitor. When an Azure Function App in a Composite Application is associated with a Watch Monitor, it will detect if any failure occurs in its Functions and the alert will be sent through the configured notification channels within 10 minutes of the failure occurrence.
I hope, this blog helps you to acquire a better knowledge of what Durable Functions are and how it can be better managed and monitored using Serverless360.
Also, check out this blog Azure Durable Functions – Patterns & Best Practices for a better understanding on Durable Functions patterns.