Durable Functions is an Azure Functions SDK extension which enables the Azure Function server-less environment to run "stateful" applications. The following example below briefly demonstrates the Fan In/Out pattern that the Durable Functions SDK enables with ease.
In this simple example, a message containing a JSON array of blob names is received by an EventHubTrigger, commences the process of reading their respective blob lengths in Azure Blob Storage and writing the summed length to an output blob.
The execution process is outlined as follows:
A message containing JSON array of blob names is received on an EventHub.
The GetBlobsLength Azure Function bound to the EventHub receives the message and forwards the payload to the Orchestrator Function (GetBlobsLengthOrchestrator).
The Orchestrator deserialises the incoming message and creates a task for each blob name which will invoke an Activity Function to get the length for the blob (GetBlobsLengthActivity).
The orchestrator calls Task.WhenAll() on the collection of tasks to run all Activities in parallel (fan out) and await for the responses of all activities before continuing (fan in).
The orchestrator writes the sum of all responses to blob via an output binding.
The code is demonstrated below:
Please click here to read more about the Durable Functions SDK.