O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Azure Durable Functions (2018-06-13)

4.622 visualizações

Publicada em

Azure Durable Functions
Serverless and Stateful Orchestrations on Azure
Presented no Azure Nights Melbourne

Publicada em: Tecnologia
  • Entre para ver os comentários

Azure Durable Functions (2018-06-13)

  1. 1. Azure Nights Melbourne Paco de la Cruz Durable Functions Serverless and Stateful Orchestrations on Azure Azure Nights Melbourne
  2. 2. Azure Nights Melbourne @pacodelacruz slideshare.net/pacodelac pacodelacruzag.wordpress.com
  3. 3. Azure Nights Melbourne Agenda
  4. 4. Azure Nights Melbourne Evolution of Application Platforms On-premises IaaS PaaS Serverless
  5. 5. Azure Nights Melbourne “Serverless” and its benefits Event-driven scaling not resource-driven Pay only for what you use Server abstraction Focus on value
  6. 6. Azure Nights Melbourne Azure Functions in a nutshell Event Triggers Code Outputs React and get inputs from a growing list of services (triggers and input bindings) C#, F#, node.js, Java, Phyton Send results to a growing list of services (output bindings)
  7. 7. Azure Nights Melbourne Some challenges of Azure Functions Manageable Sequencing + Error Handling / Compensation Fanning-out & Fanning-in Http-based Async Long-running APIs Human InteractionFlexible Automated Long-running Process Monitoring External Events Correlation Start Get Status
  8. 8. Azure Nights Melbourne Durable Function Patterns 1: Function Chaining 2: Fanning-out & Fanning-in 3: Async HTTP APIs 5: Human Interaction4: Monitoring ?: External Events Correlation Start Get Status
  9. 9. Azure Nights Melbourne Durable Functions in a nutshell Based on Durable Task Framework Using Azure Storage (Fully Managed and Abstracted) To Implement stateful workflows-as-code (C#, F# and Node.js in preview) Azure Functions Extension
  10. 10. Azure Nights Melbourne Durable Functions Components Activity Function Activity Function Activity Function Orchestrator Function Orchestration Client Start Get Status Send Event Wait for Completion Terminate Stateless Single Step Inputs and Outputs Stateful Process Manager Call Activity Functions Error Handling and Compensation Checkpointing Dehydrates during activities Rehydrates at responses / events
  11. 11. Azure Nights Melbourne Function Chaining Pattern public static async Task<object> Run( [OrchestrationTrigger] DurableOrchestrationContext ctx) { try { var x = await ctx.CallActivityAsync<object>("F1"); var y = await ctx.CallActivityAsync<object>("F2", x); return await ctx.CallActivityAsync<object>("F3", y); } catch (Exception ex) { // error handling / compensation } }
  12. 12. Azure Nights Melbourne Fan-out & Fan-In Pattern public static async Task<int> Run( [OrchestrationTrigger] DurableOrchestrationContext ctx) { object[] workBatch = await ctx.CallActivityAsync<object[]>("F1"); var tasks = new Task<long>[workBatch.Length]; for (int i = 0; i < workBatch.Length; i++) { tasks[i] = ctx.CallActivityAsync<int>("F2", workBatch[i]); } await Task.WhenAll(tasks); long sum = tasks.Sum(t => t.Result); return sum; }
  13. 13. Azure Nights Melbourne Orchestration Client public static async Task<HttpResponseMessage> Run( [HttpTrigger(AuthorizationLevel.Function, methods: "post", Route = "orchestrators/{functionName}")] HttpRequestMessage req, [OrchestrationClient] DurableOrchestrationClientBase starter, ILogger log) { // Function input comes from the request content. dynamic eventData = await req.Content.ReadAsAsync<object>(); string instanceId = await starter.StartNewAsync("myOrchestrator", eventData); log.LogInformation($"Started orchestration with ID = '{instanceId}'."); var res = starter.CreateCheckStatusResponse(req, instanceId); return res; }
  14. 14. Azure Nights Melbourne Durable Functions vs Logic Apps? vs Durable Functions Logic Apps Both allow implementing advanced workflow patterns C#, F# and JavaScript in preview Visual designer and WDL Bindings (~ 20 supported) 200+ connectors Portable Runtime Run only on Azure Monitoring based on App Insights & APIs Rich monitoring & management tools Serverless, dedicated and isolated Serverless only (dedicated in the future [ISE]) blog.mexia.com.au/azure-durable-functions-vs-logic-apps
  15. 15. Azure Nights Melbourne Additional Resources Twitter @azurefunctions Documentation aka.ms/durablefunctions Live Web Cast aka.ms/azurefunctionslive Repos github.com/Azure/azure-functions-durable-extension github.com/Azure/azure-functions-durable-js Samples github.com/Azure/azure-functions-durable- extension/tree/master/samples Pluralsight course app.pluralsight.com/library/courses/ azure-durable-functions-fundamentals
  16. 16. Azure Nights Melbourne Any questions so far?
  17. 17. Azure Nights Melbourne Demo 1 Development and Debugging Furry Models Cat Application Approval github.com/pacodelacruz/ DurableFunctions-AzureNights
  18. 18. Azure Nights Melbourne Orchestration Function Start Send Approval Request via Email Create Timer External Event Timer Expires WhenAny Move Blob to Corresponding Container End (Requests blob container) (Approved or Rejected blob container)
  19. 19. Azure Nights Melbourne Orchestration Function Start Send Approval Request via Email Create Timer External Event Timer Expires WhenAny Move Blob to Corresponding Container End BlobTrigger Function HttpTrigger Process Approval (Requests blob container) (Approved or Rejected blob container) Orchestration Client Activity Functions ActivityTrigger Send Approval Request via Email ActivityTrigger Move Blob to Corresponding Container HttpTrigger Check Status
  20. 20. Azure Nights Melbourne Demo 2 Execution & Monitoring on Azure github.com/pacodelacruz/ DurableFunctions-AzureNights
  21. 21. Azure Nights Melbourne Orchestration Function Start Send Approval Request via Slack Create Timer External Event Timer Expires WhenAny Move Blob to Corresponding Container End BlobTrigger Function HttpTrigger Process Approval (Requests blob container) (Approved or Rejected blob container) Orchestration Client Activity Functions ActivityTrigger Send Approval Request via Slack ActivityTrigger Move Blob to Corresponding Container HttpTrigger Check Status
  22. 22. Azure Nights Melbourne Let your Cat apply! Great opportunity to get famous! Send an email to: … Subject: I want to be a Furry Model! Attach your cat best picture
  23. 23. Azure Nights Melbourne Details about the demos: blog.mexia.com.au/azure-durable-functions-approval-workflow-with-sendgrid blog.mexia.com.au/azure-durable-functions-approval-workflow-with-slack github.com/pacodelacruz/ DurableFunctions-AzureNights
  24. 24. Azure Nights Melbourne Q & A
  25. 25. Azure Nights Melbourne @pacodelacruz slideshare.net/pacodelac pacodelacruzag.wordpress.com
  26. 26. Azure Nights Melbourne Thanks!

×