Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Take your azure functions to the next level with durable functions @ Experts Live 2018

Take your azure functions to the next level with durable functions @ Experts Live 2018

Slides of the presentation I gave at Experts Live 2018 in Ede about the Durable Functions extension for Azure Functions.

The source code containing all the demos (HelloWorld, Function Chaining and Fan-out/Fan-in) is located in this repo: https://github.com/marcduiker/demos-azure-durable-functions.

Fd55de4174accaf3b4f030e43a8a70c6?s=128

Marc Duiker

June 19, 2018
Tweet

Transcript

  1. None
  2. Marc Duiker Lead Consultant @ Xpirit

  3. Marc Duiker Durable Functions • Shift to Serverless • What

    are orchestrations? • Why do we need them? • What is Durable Functions? • Local development • Demos • Hello World / Hello Name • Function chaining • Fan-out/Fan-in • Unit Testing
  4. Marc Duiker Durable Functions

  5. Marc Duiker Durable Functions IaaS PaaS SaaS FaaS + Less

    maintenance + Pay as you go + More fine grained scalability - Less control - More moving parts
  6. Marc Duiker Durable Functions

  7. Marc Duiker Durable Functions Control flow

  8. Marc Duiker Durable Functions

  9. Marc Duiker Durable Functions Orchestration? Orchestration is the automated arrangement,

    coordination, and management of computer systems, middleware, and services.
  10. Marc Duiker Durable Functions

  11. Marc Duiker Durable Functions

  12. Marc Duiker Durable Functions

  13. Marc Duiker Durable Functions

  14. Marc Duiker Durable Functions

  15. Marc Duiker Durable Functions

  16. Marc Duiker Durable Functions

  17. Marc Duiker Durable Functions Durable Functions is based on

  18. Marc Duiker Durable Functions Function Roles

  19. Marc Duiker Durable Functions New Trigger Bindings [OrchestrationClient] DurableOrchestrationClient Function

    Role: Orchestration Starter
  20. Marc Duiker Durable Functions DurableOrchestrationClient

  21. Marc Duiker Durable Functions New Trigger Bindings [OrchestrationTrigger] DurableOrchestrationContext Function

    Role: Orchestration Function
  22. Marc Duiker Durable Functions DurableOrchestrationContext

  23. Marc Duiker Durable Functions New Trigger Bindings [ActivityTrigger] DurableActivityContext Function

    Role: Activity Function
  24. Marc Duiker Durable Functions DurableActivityContext

  25. Marc Duiker Durable Functions Invocations, Checkpoints & Replay Function invocation

    Execution history
  26. Marc Duiker Durable Functions Storage Types used by Durable Functions

  27. Marc Duiker Durable Functions State is Persisted in Table Storage

  28. Marc Duiker Durable Functions Considerations when using Durable Functions -

    In and output of functions should be serializable. - Orchestration Functions should be deterministic: - DateTime.Now, use CurrentUtcDateTime - Guid.NewGuid() - Random generated data
  29. Marc Duiker Durable Functions

  30. Marc Duiker Durable Functions Visual Studio 2017 15.7+ - “Azure

    development tools” workload - Extension: Azure Functions & Web Jobs Tools - Azure Storage Emulator - Azure Storage Explorer Local development
  31. Marc Duiker Durable Functions Hello World Demo! HelloWorld HelloWorldActivity HttpStart

  32. Marc Duiker Durable Functions Hello {name} Demo! HttpStart HelloName {name}

    HelloNameActivity {name}
  33. Marc Duiker Durable Functions

  34. Marc Duiker Durable Functions Function chaining

  35. Marc Duiker Durable Functions Demo: Function Chaining Find a Star

    Wars character and their home planet. https://swapi.co/
  36. Marc Duiker Durable Functions Demo: Function Chaining HttpStart GetSwCharacterInfo SearchCharacter

    GetPlanet
  37. Marc Duiker Durable Functions

  38. Marc Duiker Durable Functions Fan-out/fan-in FA1 returns a collection of

    items FA2 is called for each of the items from FA1
  39. Marc Duiker Durable Functions Demo: Fan-out/Fan-in Find a Star Wars

    planet and their residents. https://swapi.co/
  40. Marc Duiker Durable Functions Demo: Fan-out/Fan-in HttpStart GetSwPlanetResidents SearchPlanet GetCharacter

  41. Marc Duiker Durable Functions

  42. Marc Duiker Durable Functions Unit Testing Demo Testing the GetSwPlanetAndResidentials

    orchestration using: • xUnit • Moq • AutoFixture
  43. Marc Duiker Durable Functions Unit Testing • Use DurableOrchestrationContextBase in

    the orchestration. • Use serializable types with [ActivityTrigger] for the activity input. (because DurableActivityContext can’t be instantiated/mocked due to internal constructor  ).
  44. Marc Duiker Durable Functions

  45. Marc Duiker Durable Functions • Orchestration Functions can only call

    Activity Functions in the same Function App. • Keep your orchestration small. • What changes together should be deployed together. Closing remarks
  46. Marc Duiker Durable Functions GitHub: demos-azure-durable-functions blog.marcduiker.nl @marcduiker