Azure functions & Azure Durable functions

What are Microsoft Azure Functions?

  • Consumption plan: we only pay for the time that code runs;
  • App Service plan: we only pay for the App Service’s monthly fee;
  • Premium plan: right now in preview, promising maximum performances.
  • an app name;
  • a resource group;
  • an OS;
  • a hosting plan type;
  • allocation type;
  • a runtime stack;
  • Storage.

What are Microsoft Azure Durable Functions?

  • Chaining: to chain a sequence of functions with a specific order;
  • Fan-Out/Fan-In: to execute multiple long-running tasks without a particular order and waiting for them to complete;
  • Async HTTP APIs: usually implemented for the long-running job;
  • Monitoring: to monitor processes or operations;
  • Human interaction: to create a process that needs human intervention to be completed.
  • “DurableFunctionsOrchestration” as a template
  • a name and a namespace for our function;
  • an Azure Web Jobs Storage to help running our function.
  1. RunOrchestrator
  2. SayHello
  3. HttpStart
  • OrchestrationTrigger (1), which do the orchestration between different functions. It launches and retrieves data;
  • ActivityTrigger (2), which represents the functions called by the orchestrator and that handles work.
  • OrchestrationClient (3), which starts or ends the functions and let us query the status of them.
[FunctionName("CodemotionDurableFunction")]
public static async Task<List<string>> RunOrchestrator(
[OrchestrationTrigger] DurableOrchestrationContext context)
{
var inputs = new List<string>() { "Tokyo", "Seattle", "London" };

// Fan-out
var tasks = new Task<string>[inputs.Count];
for(int i = 0; i < inputs.Count; i++)
{
tasks[i] = context.CallActivityAsync<string>(
"CodemotionDurableFunction_Hello", inputs[i]);
}

await Task.WhenAll(tasks);

return tasks.Select(t => t.Result).ToList();
}
["Hello Tokyo!","Hello Seattle!","Hello London!"]

Conclusion

--

--

--

We help tech communities to grow worldwide, providing top-notch tools and unparalleled networking opportunities.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

[Ebook]^^ Mastering PostgreSQL 11: Expert techniques to build scalable, reliable, and…

OOPs concept in JAVA

Using Command Line Tools to Aid Development — Part 1 (Grep)

How we develop client projects

How to Track Applications Using Your Network in Windows 10?

**** Hybrid-Multi-Cloud-Task 2****

Left-recursive PEG grammars

Estimation Of Water Usage

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Codemotion

Codemotion

We help tech communities to grow worldwide, providing top-notch tools and unparalleled networking opportunities.

More from Medium

.NET on AWS — Data Persistence using RDS

Automagically REST and GraphQL endpoints from your Azure SQL database

Resources for .NET Developers (May 2022)

Using Azure Key Vault secrets in Azure DevOps Pipelines