Introduction

It will cover the following things,

Application patterns

The following application patterns can benefit from Durable Functions:

Pre-requisites

These are pre-requisites to start working on durable functions

What is a Monitoring pattern?

Hands-on Lab – Create durable function using Monitoring pattern in C#

Steps to be followed,

Open VS 2019 and create a project.

Choose the Azure function template and create a directory.

Durable Functions - Patterns - Monitor

Choose durable functions orchestration template.

Durable Functions - Patterns - Monitor

Once the application has been created, we would see three functions,

Durable Functions - Patterns - Monitor

Durable Functions - Patterns - Monitor

Run (F5) the application and see all the functions that have been listed here.

Durable Functions - Patterns - Monitor

In this above example, you see an HTTP URL that allows instantiating the orchestration,

Copy the URL of Function1_HttpStart and run it in the browser.

Durable Functions - Patterns - Monitor

Copy the URL of statusQueryGetUri (GET URL) and run it in the browser.

Durable Functions - Patterns - Monitor

Durable Functions - Patterns - Monitor

Here, you can see the events run, HTTP_START calls MonitorJobStatus followed by GetJobStatus, SendAlert, and MonitorJobStatus.

Hands-on Lab – Deploy a durable function using Monitoring pattern on Azure

Steps to be followed,

Right-click on the function and click on publish and choose target as Azure.

Durable Functions - Patterns - Monitor

Choose an option as Azure function app (Windows).

Durable Functions - Patterns - Monitor

Create/choose the new/existing resource group and resource for azure function deployment.

Durable Functions - Patterns - Monitor

Click on Finish and let it get published and once published, go to the Azure portal and test the function app using the steps which we did in the above steps while creating durable functions

This is a basic example of Monitoring, where Orchestrator or main function is responsible for calling job status function and if it is completed and then calls the send alert, which means constantly monitoring the job status or anything and perform an action based on the results

There are multiple other patterns that represent where to use duration functions, stay tuned for the next series of articles to get a hang of it.

Happy learning!