SlideShare a Scribd company logo
This session will commence shortly
We are constantly striving to create excellent content
and would appreciate if you could take this brief survey.
Survey Link: https://aka.ms/Reactor/Survey
Please enter the event code 12789 at the start of survey
meetup.com/Microsoft-Reactor-Stockholm/
Speaker Slide:
Massimo Bonanni
Azure Technical Trainer @ Microsoft
I spend my time to help customers to empower their Azure skills to achieve more and leverage the
power of Azure in their solutions.
I’m also a technical speaker both for local and international events and a user-group guy.
I founded Aa couple of communities in Italy and collaborated with most of the Italian communities.
Finally, I is also passionate about biking, reading, and dogs!!
meetup.com/Microsoft-Reactor-Stockholm/
Stateful patterns in Azure Functions
Massimo Bonanni
Azure Technical Trainer @ Microsoft
Be aware of others
Be friendly and
patient
Be welcoming and
respectful
Be open to all
questions and
viewpoints
Be understanding of
differences
Be kind and
considerate to others
meetup.com/Microsoft-Reactor-Stockholm/
What are Azure Functions?
Author functions in
C#, F#, Node.JS, Java,
and more
Code
Events
React to timers, HTTP, or
events from your favorite
Azure services, with more
on the way
Outputs
Send results to an
ever-growing
collection of services
meetup.com/Microsoft-Reactor-Stockholm/
Functions must be stateless
Functions cannot call other functions
Functions should do only one thing
Principles and best practices…
meetup.com/Microsoft-Reactor-Stockholm/
Workflow manages state
Workflow is interactions between
components
Workflows must do more than one thing
… and workflows!?!?!
The magic is
Durable Functions!!
meetup.com/Microsoft-Reactor-Stockholm/
Azure Functions
Extension
Based on Azure
Functions
Adds new Triggers and
Bindings
Manages state,
checkpoints, and
restarts
Durable Task
Framework
Long running persistent
workflows in C#
Used within various
teams at Microsoft to
reliably orchestrate long
running operations
Languages
C#
JavaScript
F#
Python
Powershell
What are Durable Functions?
meetup.com/Microsoft-Reactor-Stockholm/
Durable Function components
Client
Is the triggered
functions that will
create new instances
of an orchestration.
It is the entry point for
creating an instance of
a durable orchestration
Orchestrator
Is the heart of a
durable function.
Orchestrator functions
describe the way and
order actions are
executed.
Activity
Is the basic unit of
work in a durable
orchestration.
An activity function
must be triggered by
an activity trigger.
meetup.com/Microsoft-Reactor-Stockholm/
Function chaining
Relations between functions and queues aren’t clearly identifying
Queues are an implementation detail
Operation context management is difficult
Error handling is difficult
meetup.com/Microsoft-Reactor-Stockholm/
Function chaining in Durable Functions
Orchestrator Function
Activity Functions
meetup.com/Microsoft-Reactor-Stockholm/
Function chaining in Durable Functions
The magic is
Event Sourcing!!
meetup.com/Microsoft-Reactor-Stockholm/
1. var x = await context.CallActivityAsync<int>("F1", null);
2. var y = await context.CallActivityAsync<int>("F2", x);
3. return await context.CallActivityAsync<int>("F3", y);
Orchestrator Function
Client
Orchestrator
Activity
F1 => return 42;
F2 => return value + 1;
F3 => return value + 2;
Event History
Orchestrator Started
Task Scheduled, F1
Task Completed, F1 => 42
Task Scheduled, F2
Task Completed, F2 => 43
Task Scheduled, F3
Task Completed, F3 => 45
Orchestrator Completed => 45
Storage managed by
Durable Task Framework
Stateful patterns in Azure Functions
meetup.com/Microsoft-Reactor-Stockholm/
Orchestrator MUST be deterministic
Never write logic that depends on random
numbers, current date/time, delay, etc.
Never do I/O in the orchestrator function
Never start custom thread in the orchestrator
function
Do not write infinite loops
meetup.com/Microsoft-Reactor-Stockholm/
FanIn-FanOut
FanIn is simple, but FanOut is more complicated
The platform must track progress of all work
All the same issues of Function Chain
meetup.com/Microsoft-Reactor-Stockholm/
FanIn-FanOut in Durable Functions
meetup.com/Microsoft-Reactor-Stockholm/
FanIn-FanOut in Durable Functions
meetup.com/Microsoft-Reactor-Stockholm/
Human interaction
Handling race conditions between timeouts and
approval
Need mechanism for implementing and cancelling
timeout events
Same issues as the other pattern
meetup.com/Microsoft-Reactor-Stockholm/
Human Interaction in Durable Functions
meetup.com/Microsoft-Reactor-Stockholm/
Human Interaction in Durable Functions
meetup.com/Microsoft-Reactor-Stockholm/
Aggregator
Storing the state
Correlation of event for a particular state
Syncronization of access to the state
The magic is
Durable Entities!!
meetup.com/Microsoft-Reactor-Stockholm/
Actor model
meetup.com/Microsoft-Reactor-Stockholm/
Entity Functions define
operations for reading and
updating small piece of
state
Entity Functions are
functions with special
trigger
Entity Functions are
accessed using:
• Entity Name
• Entity key
Entity Functions expose
operations that can be accessed
using:
• Entity Key
• Operation Name
• Operation Input
• Scheduled time
Durable Entities aka Entity Functions
meetup.com/Microsoft-Reactor-Stockholm/
Accessing the Entities
Two-way (round-trip) communication.
You send an operation message to the entity, and then
wait for the response message before you continue.
Calling
(round-
trip)
One-way (fire and forget) communication.
You send an operation message but don't wait for a
response.
Signaling
(fire-and-
forget)
Two-way communication.
You can retrieve the state of an entity
State
Orchestrator
Orchestrator
Client
Entity
Client
meetup.com/Microsoft-Reactor-Stockholm/
Anatomy of an Entity
Properties (state)
Operations
Entry Function
Stateful patterns in Azure Functions
meetup.com/Microsoft-Reactor-Stockholm/
Designed for reliability, not for latency
Workflow by code
Durable Entities are similar to Virtual Actor
Solve the concurrency issues, but is it the
right choice?
Takeaways
meetup.com/Microsoft-Reactor-Stockholm/
Thanks for your
attention!!!!!
Massimo Bonanni
Azure Technical Trainer
massimo.bonanni@microsoft.com
@massimobonanni
Connect with me on LinkedIn
linkedin.com/in/massimobonanni/
http://bit.ly/MasteringServerless
meetup.com/Microsoft-Reactor-Stockholm/
Join our community
meetup.com/Microsoft-Reactor-Stockholm/
@MSFTReactor
http://www.youtube.com/c/MicrosoftReactor
Microsoft Reactor at Epicenter,
Master Samuelsgatan 36, 5th floor,
111 57 Stockholm Sweden
Questions? ReactorStockholm@microsoft.com
ReactorStockholm@microsoft.com
meetup.com/Microsoft-Reactor-Stockholm/
References
Photo by Jaredd Craig on Unsplash
https://docs.microsoft.com/en-US/azure/azure-functions/
https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-
overview?tabs=csharp
https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-dotnet-entities
https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-
entities?tabs=csharp
https://docs.microsoft.com/en-us/azure/azure-functions/durable/quickstart-python-vscode
https://github.com/Azure/durabletask
https://github.com/massimobonanni/StatefulPatternFunctions

More Related Content

What's hot (20)

PDF
Empower every Azure Function to achieve more!!
Massimo Bonanni
 
PDF
5c8605.ado.net
harkesh singh
 
PPT
Ado.Net Data Services (Astoria)
Igor Moochnick
 
PPTX
Discovering the Service Fabric's actor model
Massimo Bonanni
 
PDF
IoT in salsa serverless
Massimo Bonanni
 
PPT
Servicehost Customization
Eyal Vardi
 
PPT
Linq
tnkreddy
 
PPTX
Net campus2015 antimomusone
DotNetCampus
 
PPTX
Testing a Service Fabric solution and live happy!!
Massimo Bonanni
 
PPTX
Windows iot barone
DotNetCampus
 
PPTX
Code Generation for Azure with .net
Marco Parenzan
 
PPTX
Discovering the Service Fabric's actor model
Massimo Bonanni
 
PPTX
First Look at Azure Logic Apps (BAUG)
Daniel Toomey
 
PPTX
Why I am hooked on the future of React
Maurice De Beijer [MVP]
 
PPTX
Background processing with hangfire
Aleksandar Bozinovski
 
PPTX
It depends: Loving .NET Core dependency injection or not
Alex Thissen
 
PPTX
Setting Up Development Environment For Google App Engine & Python | Talentica
Talentica Software
 
PDF
White paper mbre_en
VisioneerUG
 
PPTX
Build PWA with Ionic Toolkit
Pavel Kurnosov
 
PDF
Alex Thissen "It depends: loving .NET Core dependency injection or not"
Fwdays
 
Empower every Azure Function to achieve more!!
Massimo Bonanni
 
5c8605.ado.net
harkesh singh
 
Ado.Net Data Services (Astoria)
Igor Moochnick
 
Discovering the Service Fabric's actor model
Massimo Bonanni
 
IoT in salsa serverless
Massimo Bonanni
 
Servicehost Customization
Eyal Vardi
 
Linq
tnkreddy
 
Net campus2015 antimomusone
DotNetCampus
 
Testing a Service Fabric solution and live happy!!
Massimo Bonanni
 
Windows iot barone
DotNetCampus
 
Code Generation for Azure with .net
Marco Parenzan
 
Discovering the Service Fabric's actor model
Massimo Bonanni
 
First Look at Azure Logic Apps (BAUG)
Daniel Toomey
 
Why I am hooked on the future of React
Maurice De Beijer [MVP]
 
Background processing with hangfire
Aleksandar Bozinovski
 
It depends: Loving .NET Core dependency injection or not
Alex Thissen
 
Setting Up Development Environment For Google App Engine & Python | Talentica
Talentica Software
 
White paper mbre_en
VisioneerUG
 
Build PWA with Ionic Toolkit
Pavel Kurnosov
 
Alex Thissen "It depends: loving .NET Core dependency injection or not"
Fwdays
 

Similar to Stateful patterns in Azure Functions (20)

PPTX
Develop in ludicrous mode with azure serverless
Lalit Kale
 
PPTX
Developing Actors in Azure with .net
Marco Parenzan
 
PPTX
Building workflow solution with Microsoft Azure and Cloud | Integration Monday
BizTalk360
 
PPTX
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
João Pedro Martins
 
PPT
Silverlight 2 for Developers - TechEd New Zealand 2008
Jonas Follesø
 
PPTX
Mike Taulty MIX10 Silverlight Frameworks and Patterns
ukdpe
 
PPT
D22 portlet development with open source frameworks
Sunil Patil
 
PPT
D22 Portlet Development With Open Source Frameworks
Sunil Patil
 
PDF
Nt1310 Unit 3 Language Analysis
Nicole Gomez
 
PPT
The Magic Of Application Lifecycle Management In Vs Public
David Solivan
 
PDF
Exploiting Web Technologies to connect business process management and engine...
Stefano Costanzo
 
PPT
Akka.Net & .Net Core - .Net Inside 4° MeetUp
Alexandre Brandão Lustosa
 
PDF
Informatica course curriculum
Amit Sharma
 
PDF
Stateful mock servers to the rescue on REST ecosystems
Nuno Caneco
 
PPT
PowerPoint
Videoguy
 
PPTX
Rethinking Best Practices
floydophone
 
ODP
Intro To Spring Python
gturnquist
 
PDF
Introduction to Functional Reactive Web with Clojurescript
John Stevenson
 
PPTX
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
Thomas Conté
 
PPT
Ibm
techbed
 
Develop in ludicrous mode with azure serverless
Lalit Kale
 
Developing Actors in Azure with .net
Marco Parenzan
 
Building workflow solution with Microsoft Azure and Cloud | Integration Monday
BizTalk360
 
Azure Service Fabric and the Actor Model: when did we forget Object Orientation?
João Pedro Martins
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Jonas Follesø
 
Mike Taulty MIX10 Silverlight Frameworks and Patterns
ukdpe
 
D22 portlet development with open source frameworks
Sunil Patil
 
D22 Portlet Development With Open Source Frameworks
Sunil Patil
 
Nt1310 Unit 3 Language Analysis
Nicole Gomez
 
The Magic Of Application Lifecycle Management In Vs Public
David Solivan
 
Exploiting Web Technologies to connect business process management and engine...
Stefano Costanzo
 
Akka.Net & .Net Core - .Net Inside 4° MeetUp
Alexandre Brandão Lustosa
 
Informatica course curriculum
Amit Sharma
 
Stateful mock servers to the rescue on REST ecosystems
Nuno Caneco
 
PowerPoint
Videoguy
 
Rethinking Best Practices
floydophone
 
Intro To Spring Python
gturnquist
 
Introduction to Functional Reactive Web with Clojurescript
John Stevenson
 
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
Thomas Conté
 
Ibm
techbed
 
Ad

More from Massimo Bonanni (18)

PDF
Architetture Serverless con SQL Server e Azure Functions
Massimo Bonanni
 
PDF
Tutto quello che avreste voluto sapere sull'API Management (e non avete mai o...
Massimo Bonanni
 
PDF
Everything you always wanted to know about API Management (but were afraid to...
Massimo Bonanni
 
PDF
Xmas Serverless Transformation: when the elf doesn’t scale!
Massimo Bonanni
 
PPTX
Welcome Azure Functions 2. 0
Massimo Bonanni
 
PPTX
Soluzioni IoT con le tecnologie Microsoft
Massimo Bonanni
 
PPTX
Project Gesture & Real Sense: il potere nelle mani!!
Massimo Bonanni
 
PPTX
Project Gesture & RealSense: gestures in a simple way!!
Massimo Bonanni
 
PPTX
Project Prague & RealSense: il potere nelle mani!!
Massimo Bonanni
 
PPTX
L'approccio ai microservizi secondo Service Fabric
Massimo Bonanni
 
PPTX
The Microservices world in. NET Core and. NET framework
Massimo Bonanni
 
PPTX
Microservices architecture & Service Fabric
Massimo Bonanni
 
PPTX
Introduzione allo sviluppo UWP per xBox
Massimo Bonanni
 
PPTX
Cognitive Services & LUIS
Massimo Bonanni
 
PPTX
Service Fabric: la potenza dei micro servizi
Massimo Bonanni
 
PPTX
Automated UI testing for iOs and Android mobile apps
Massimo Bonanni
 
PPTX
Soluzioni IoT con le tecnologie Microsoft
Massimo Bonanni
 
PPTX
Xamarin Test Cloud
Massimo Bonanni
 
Architetture Serverless con SQL Server e Azure Functions
Massimo Bonanni
 
Tutto quello che avreste voluto sapere sull'API Management (e non avete mai o...
Massimo Bonanni
 
Everything you always wanted to know about API Management (but were afraid to...
Massimo Bonanni
 
Xmas Serverless Transformation: when the elf doesn’t scale!
Massimo Bonanni
 
Welcome Azure Functions 2. 0
Massimo Bonanni
 
Soluzioni IoT con le tecnologie Microsoft
Massimo Bonanni
 
Project Gesture & Real Sense: il potere nelle mani!!
Massimo Bonanni
 
Project Gesture & RealSense: gestures in a simple way!!
Massimo Bonanni
 
Project Prague & RealSense: il potere nelle mani!!
Massimo Bonanni
 
L'approccio ai microservizi secondo Service Fabric
Massimo Bonanni
 
The Microservices world in. NET Core and. NET framework
Massimo Bonanni
 
Microservices architecture & Service Fabric
Massimo Bonanni
 
Introduzione allo sviluppo UWP per xBox
Massimo Bonanni
 
Cognitive Services & LUIS
Massimo Bonanni
 
Service Fabric: la potenza dei micro servizi
Massimo Bonanni
 
Automated UI testing for iOs and Android mobile apps
Massimo Bonanni
 
Soluzioni IoT con le tecnologie Microsoft
Massimo Bonanni
 
Xamarin Test Cloud
Massimo Bonanni
 
Ad

Recently uploaded (20)

PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
July Patch Tuesday
Ivanti
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Python basic programing language for automation
DanialHabibi2
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 

Stateful patterns in Azure Functions