SlideShare une entreprise Scribd logo
1  sur  21
Azure Durable
Funkiness
@stuartleeks
Web and Cloud geek @ Microsoft
The Evolution of
Code
C# Edition
Sync -> Async -> Parallel -> Distributed
Synchronous
void DemoSync()
{
try // try/catch and using work nicely
{
DoStuff();
DoMoreStuff();
DoEvenMoreStuff();
}
catch (Exception ex)
{
// Handle exception
}
}
Asynchronous
async Task<string[]> DemoAsync()
{
try // try/catch and using work nicely
{
var x = await DoStuffAsync();
var y = await DoMoreStuffAsync();
var z = await DoEvenMoreStuffAsync();
return new[] { x, y, z };
}
catch (Exception ex)
{
// Handle exception
}
}
Asynchronous
async Task<string[]> DemoAsync()
{
try // try/catch and using work nicely
{
var x = await DoStuffAsync();
var y = await DoMoreStuffAsync();
var z = await DoEvenMoreStuffAsync();
return new[] { x, y, z };
}
catch (Exception ex)
{
// Handle exception
}
}
Asynchronous
async Task<string[]> Demo2Async()
{
try // try/catch and using work nicely
{
var taskx = DoStuffAsync();
var x = await taskx;
var y = await DoMoreStuffAsync();
var z = await DoEvenMoreStuffAsync();
return new[] { x, y, z };
}
catch (Exception ex)
{
// Handle exception
}
}
Parallel
async Task<string> Demo1Parallel()
{
try // try/catch and using work nicely
{
var task1 = DoStuffAsync();
var task2 = DoMoreStuffAsync();
await task1;
await task2;
return await DoStuffAfterOtherStuffAsync(task1.Result, task2.Result);
}
catch (Exception ex)
{
// Handle exception
}
}
Parallel
async Task<string> DemoParallel()
{
try // try/catch and using work nicely
{
var task1 = DoStuffAsync();
var task2 = DoMoreStuffAsync();
await Task.WhenAll(task1, task2);
return await DoStuffAfterOtherStuffAsync(task1.Result, task2.Result);
}
catch (Exception ex)
{
// Handle exception
}
}
Sync -> Async -> Parallel
Azure Durable Functions
Sync -> Async -> Parallel -> Distributed
Distributed - Chaining
async Task<string[]> Run1(DurableOrchestrationContext ctx)
{
try // try/catch and using work nicely
{
var x = await ctx.CallActivityAsync<string>("DoStuffAsync");
var y = await ctx.CallActivityAsync<string>("DoMoreStuffAsync");
var z = await ctx.CallActivityAsync<string>("DoEvenMoreStuffAsync");
return new[] { x, y, z };
}
catch (Exception)
{
// Handle exception
}
}
Distributed – Fan-out/Fan-in
public static async Task<string> Run2(DurableOrchestrationContext ctx)
{
try // try/catch and using work nicely
{
var task1 = ctx.CallActivityAsync<string>("DoStuffASync");
var task2 = ctx.CallActivityAsync<string>("DoMoreStuffASync");
await Task.WhenAll(task1, task2);
return await ctx.CallActivityAsync<string>("DoStuffAfterOtherStuffAsync", task1.Result, task2.Result);
}
catch (Exception)
{
// Handle exception
}
}
Durable Functions - Patterns
Distributed – Trigger function
[FunctionName("Start")]
public static async Task<HttpResponseMessage> Start(
[HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequestMessage request,
[OrchestrationClient] DurableOrchestrationClient starter)
{
var instanceId = await starter.StartNewAsync("WaitForApproval");
return starter.CreateCheckStatusResponse(request, instanceId);
}
Distributed – Timers and External Events
[FunctionName(“WaitForApproval")]
public static async Task<string> WaitForApproval(DurableOrchestrationContext ctx)
{
var approvedTask = ctx.WaitForExternalEvent<string>("Approved");
var cts = new CancellationTokenSource();
var timeoutTask = context.CreateTimer(context.CurrentUtcDateTime.AddMinutes(5), cts.Token);
var winningTask = await Task.WhenAny(approvedTask, timeoutTask);
if (winningTask == timeoutTask)
await ctx.CallActivityAsync<string>(“Escalate");
else
await ctx.CallActivityAsync<string>(“Success");
}
Distributed – Timers and External Events
[FunctionName(“Approve")]
public static async Task<HttpResponseMessage> Approve(
[HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequestMessage request,
[OrchestrationClient] DurableOrchestrationClient starter)
{
var instanceId = request.RequestUri.ParseQueryString()["instanceId"];
return starter.RaiseEventAsync(instanceId, "Approved", "Stuart Leeks");
}
Durable Functions - Patterns
Durable Functions
http://aka.ms/durablefunctions
The Evolution of
Code
C# Edition
With Azure Functions
Durable Functions
http://aka.ms/durablefunctions

Contenu connexe

Tendances

如何「畫圖」寫測試 - RxJS Marble Test
如何「畫圖」寫測試 - RxJS Marble Test如何「畫圖」寫測試 - RxJS Marble Test
如何「畫圖」寫測試 - RxJS Marble Test名辰 洪
 
Ejercicios
EjerciciosEjercicios
Ejerciciosleonharo
 
システムコールトレーサーの動作原理と実装 (Writing system call tracer for Linux/x86)
システムコールトレーサーの動作原理と実装 (Writing system call tracer for Linux/x86)システムコールトレーサーの動作原理と実装 (Writing system call tracer for Linux/x86)
システムコールトレーサーの動作原理と実装 (Writing system call tracer for Linux/x86)Masashi Shibata
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator OverloadingMani Singh
 
Леонид Шевцов «Clojure в деле»
Леонид Шевцов «Clojure в деле»Леонид Шевцов «Clojure в деле»
Леонид Шевцов «Clojure в деле»DataArt
 
completion_proc and history
completion_proc and historycompletion_proc and history
completion_proc and historyNobuhiro IMAI
 
RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術名辰 洪
 
Call stack, event loop and async programming
Call stack, event loop and async programmingCall stack, event loop and async programming
Call stack, event loop and async programmingMasters Academy
 
JavaScript - Agora nervoso
JavaScript - Agora nervosoJavaScript - Agora nervoso
JavaScript - Agora nervosoLuis Vendrame
 
37562259 top-consuming-process
37562259 top-consuming-process37562259 top-consuming-process
37562259 top-consuming-processskumner
 
Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Atsushi Tadokoro
 
LvivPy4 - Threading vs asyncio
LvivPy4 - Threading vs asyncioLvivPy4 - Threading vs asyncio
LvivPy4 - Threading vs asyncioRoman Rader
 
我在豆瓣使用Emacs
我在豆瓣使用Emacs我在豆瓣使用Emacs
我在豆瓣使用Emacs董 伟明
 
Promises in JavaScript
Promises in JavaScriptPromises in JavaScript
Promises in JavaScriptRevath S Kumar
 

Tendances (20)

The Big Three
The Big ThreeThe Big Three
The Big Three
 
如何「畫圖」寫測試 - RxJS Marble Test
如何「畫圖」寫測試 - RxJS Marble Test如何「畫圖」寫測試 - RxJS Marble Test
如何「畫圖」寫測試 - RxJS Marble Test
 
Ejercicios
EjerciciosEjercicios
Ejercicios
 
Node intro
Node introNode intro
Node intro
 
システムコールトレーサーの動作原理と実装 (Writing system call tracer for Linux/x86)
システムコールトレーサーの動作原理と実装 (Writing system call tracer for Linux/x86)システムコールトレーサーの動作原理と実装 (Writing system call tracer for Linux/x86)
システムコールトレーサーの動作原理と実装 (Writing system call tracer for Linux/x86)
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
Introduzione a C#
Introduzione a C#Introduzione a C#
Introduzione a C#
 
Леонид Шевцов «Clojure в деле»
Леонид Шевцов «Clojure в деле»Леонид Шевцов «Clojure в деле»
Леонид Шевцов «Clojure в деле»
 
Java 7 new features
Java 7 new featuresJava 7 new features
Java 7 new features
 
completion_proc and history
completion_proc and historycompletion_proc and history
completion_proc and history
 
RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術
 
Call stack, event loop and async programming
Call stack, event loop and async programmingCall stack, event loop and async programming
Call stack, event loop and async programming
 
The State of JavaScript
The State of JavaScriptThe State of JavaScript
The State of JavaScript
 
JavaScript - Agora nervoso
JavaScript - Agora nervosoJavaScript - Agora nervoso
JavaScript - Agora nervoso
 
37562259 top-consuming-process
37562259 top-consuming-process37562259 top-consuming-process
37562259 top-consuming-process
 
Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2
 
LvivPy4 - Threading vs asyncio
LvivPy4 - Threading vs asyncioLvivPy4 - Threading vs asyncio
LvivPy4 - Threading vs asyncio
 
Arp
ArpArp
Arp
 
我在豆瓣使用Emacs
我在豆瓣使用Emacs我在豆瓣使用Emacs
我在豆瓣使用Emacs
 
Promises in JavaScript
Promises in JavaScriptPromises in JavaScript
Promises in JavaScript
 

Similaire à Azure Durable Funkiness - .NET Oxford June 2018

Deep Dive async/await in Unity with UniTask(EN)
Deep Dive async/await in Unity with UniTask(EN)Deep Dive async/await in Unity with UniTask(EN)
Deep Dive async/await in Unity with UniTask(EN)Yoshifumi Kawai
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3Simon Su
 
20220529_UniTask_Intro.pptx
20220529_UniTask_Intro.pptx20220529_UniTask_Intro.pptx
20220529_UniTask_Intro.pptxRiver Wang
 
ES6 - Next Generation Javascript
ES6 - Next Generation JavascriptES6 - Next Generation Javascript
ES6 - Next Generation JavascriptRamesh Nair
 
rx.js make async programming simpler
rx.js make async programming simplerrx.js make async programming simpler
rx.js make async programming simplerAlexander Mostovenko
 
WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...
WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...
WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...GeeksLab Odessa
 
Asynchronní programování
Asynchronní programováníAsynchronní programování
Asynchronní programováníPeckaDesign.cz
 
Activator and Reactive at Play NYC meetup
Activator and Reactive at Play NYC meetupActivator and Reactive at Play NYC meetup
Activator and Reactive at Play NYC meetupHenrik Engström
 
Akka Futures and Akka Remoting
Akka Futures  and Akka RemotingAkka Futures  and Akka Remoting
Akka Futures and Akka RemotingKnoldus Inc.
 
The Design of the Scalaz 8 Effect System
The Design of the Scalaz 8 Effect SystemThe Design of the Scalaz 8 Effect System
The Design of the Scalaz 8 Effect SystemJohn De Goes
 
FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6Dmitry Soshnikov
 
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...PROIDEA
 
Think Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSThink Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSAdam L Barrett
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVMVaclav Pech
 
Asynchronous web apps with the Play Framework 2.0
Asynchronous web apps with the Play Framework 2.0Asynchronous web apps with the Play Framework 2.0
Asynchronous web apps with the Play Framework 2.0Oscar Renalias
 

Similaire à Azure Durable Funkiness - .NET Oxford June 2018 (20)

Deep Dive async/await in Unity with UniTask(EN)
Deep Dive async/await in Unity with UniTask(EN)Deep Dive async/await in Unity with UniTask(EN)
Deep Dive async/await in Unity with UniTask(EN)
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3
 
Rxjs kyivjs 2015
Rxjs kyivjs 2015Rxjs kyivjs 2015
Rxjs kyivjs 2015
 
20220529_UniTask_Intro.pptx
20220529_UniTask_Intro.pptx20220529_UniTask_Intro.pptx
20220529_UniTask_Intro.pptx
 
ES6 - Next Generation Javascript
ES6 - Next Generation JavascriptES6 - Next Generation Javascript
ES6 - Next Generation Javascript
 
rx.js make async programming simpler
rx.js make async programming simplerrx.js make async programming simpler
rx.js make async programming simpler
 
WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...
WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...
WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...
 
Asynchronní programování
Asynchronní programováníAsynchronní programování
Asynchronní programování
 
Activator and Reactive at Play NYC meetup
Activator and Reactive at Play NYC meetupActivator and Reactive at Play NYC meetup
Activator and Reactive at Play NYC meetup
 
Scala - brief intro
Scala - brief introScala - brief intro
Scala - brief intro
 
Unfiltered Unveiled
Unfiltered UnveiledUnfiltered Unveiled
Unfiltered Unveiled
 
Akka Futures and Akka Remoting
Akka Futures  and Akka RemotingAkka Futures  and Akka Remoting
Akka Futures and Akka Remoting
 
Fault tolerance made easy
Fault tolerance made easyFault tolerance made easy
Fault tolerance made easy
 
The Design of the Scalaz 8 Effect System
The Design of the Scalaz 8 Effect SystemThe Design of the Scalaz 8 Effect System
The Design of the Scalaz 8 Effect System
 
FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6
 
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
 
Think Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSThink Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJS
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVM
 
Async java8
Async java8Async java8
Async java8
 
Asynchronous web apps with the Play Framework 2.0
Asynchronous web apps with the Play Framework 2.0Asynchronous web apps with the Play Framework 2.0
Asynchronous web apps with the Play Framework 2.0
 

Dernier

How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 

Dernier (20)

How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 

Azure Durable Funkiness - .NET Oxford June 2018

  • 3. Sync -> Async -> Parallel -> Distributed
  • 4. Synchronous void DemoSync() { try // try/catch and using work nicely { DoStuff(); DoMoreStuff(); DoEvenMoreStuff(); } catch (Exception ex) { // Handle exception } }
  • 5. Asynchronous async Task<string[]> DemoAsync() { try // try/catch and using work nicely { var x = await DoStuffAsync(); var y = await DoMoreStuffAsync(); var z = await DoEvenMoreStuffAsync(); return new[] { x, y, z }; } catch (Exception ex) { // Handle exception } }
  • 6. Asynchronous async Task<string[]> DemoAsync() { try // try/catch and using work nicely { var x = await DoStuffAsync(); var y = await DoMoreStuffAsync(); var z = await DoEvenMoreStuffAsync(); return new[] { x, y, z }; } catch (Exception ex) { // Handle exception } }
  • 7. Asynchronous async Task<string[]> Demo2Async() { try // try/catch and using work nicely { var taskx = DoStuffAsync(); var x = await taskx; var y = await DoMoreStuffAsync(); var z = await DoEvenMoreStuffAsync(); return new[] { x, y, z }; } catch (Exception ex) { // Handle exception } }
  • 8. Parallel async Task<string> Demo1Parallel() { try // try/catch and using work nicely { var task1 = DoStuffAsync(); var task2 = DoMoreStuffAsync(); await task1; await task2; return await DoStuffAfterOtherStuffAsync(task1.Result, task2.Result); } catch (Exception ex) { // Handle exception } }
  • 9. Parallel async Task<string> DemoParallel() { try // try/catch and using work nicely { var task1 = DoStuffAsync(); var task2 = DoMoreStuffAsync(); await Task.WhenAll(task1, task2); return await DoStuffAfterOtherStuffAsync(task1.Result, task2.Result); } catch (Exception ex) { // Handle exception } }
  • 10. Sync -> Async -> Parallel
  • 12. Sync -> Async -> Parallel -> Distributed
  • 13. Distributed - Chaining async Task<string[]> Run1(DurableOrchestrationContext ctx) { try // try/catch and using work nicely { var x = await ctx.CallActivityAsync<string>("DoStuffAsync"); var y = await ctx.CallActivityAsync<string>("DoMoreStuffAsync"); var z = await ctx.CallActivityAsync<string>("DoEvenMoreStuffAsync"); return new[] { x, y, z }; } catch (Exception) { // Handle exception } }
  • 14. Distributed – Fan-out/Fan-in public static async Task<string> Run2(DurableOrchestrationContext ctx) { try // try/catch and using work nicely { var task1 = ctx.CallActivityAsync<string>("DoStuffASync"); var task2 = ctx.CallActivityAsync<string>("DoMoreStuffASync"); await Task.WhenAll(task1, task2); return await ctx.CallActivityAsync<string>("DoStuffAfterOtherStuffAsync", task1.Result, task2.Result); } catch (Exception) { // Handle exception } }
  • 16. Distributed – Trigger function [FunctionName("Start")] public static async Task<HttpResponseMessage> Start( [HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequestMessage request, [OrchestrationClient] DurableOrchestrationClient starter) { var instanceId = await starter.StartNewAsync("WaitForApproval"); return starter.CreateCheckStatusResponse(request, instanceId); }
  • 17. Distributed – Timers and External Events [FunctionName(“WaitForApproval")] public static async Task<string> WaitForApproval(DurableOrchestrationContext ctx) { var approvedTask = ctx.WaitForExternalEvent<string>("Approved"); var cts = new CancellationTokenSource(); var timeoutTask = context.CreateTimer(context.CurrentUtcDateTime.AddMinutes(5), cts.Token); var winningTask = await Task.WhenAny(approvedTask, timeoutTask); if (winningTask == timeoutTask) await ctx.CallActivityAsync<string>(“Escalate"); else await ctx.CallActivityAsync<string>(“Success"); }
  • 18. Distributed – Timers and External Events [FunctionName(“Approve")] public static async Task<HttpResponseMessage> Approve( [HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequestMessage request, [OrchestrationClient] DurableOrchestrationClient starter) { var instanceId = request.RequestUri.ParseQueryString()["instanceId"]; return starter.RaiseEventAsync(instanceId, "Approved", "Stuart Leeks"); }
  • 21. The Evolution of Code C# Edition With Azure Functions Durable Functions http://aka.ms/durablefunctions