Process-oriented reactive service architecture


Published on

Reactive application development gives us better ways to build scalable applications, but often together with a micro-services jigsaw puzzle. Decoupled teams can rapidly deliver decoupled services, but you still need to piece together an end-to-end system. This presentation introduces an alternative way to think about and architect reactive applications using workflow tools.

Modern workflow management tools enable a convenient process-oriented approach to service orchestration that is itself reactive. More importantly, process management technology provides two key features that hand-coded applications typically lack: persistent execution state and an editable graphical process representation that you can use to define and adjust service orchestration. After learning how to coordinate micro-services, you will also and how to use the same system to orchestrate micro-service-like human workers. It turns out that with the right platform, human actors can also be reactive services, and participate in the same architecture.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Process-oriented reactive service architecture

  1. 1. @PeterHilton Process-oriented reactive service architecture Using workflow tools to orchestrate microservices and human workers
  2. 2. Outline Reactive programming Microservices Workflow automation Orchestrating µservices with workflows Microservices vs human workers 2@PeterHilton •
  3. 3. Reactive programming
  4. 4. jaymarable / CC BY 2.0 Order processing example
 1. Receive order from customer 2. Validate order
 (Notify customer if order is not valid) 3. Fulfil order and ship from warehouse 4. Send delivery estimate to customer 5. Update inventory management system 6. Mark order as complete
  5. 5. ⚙ ⚙ ⚙ ⚙ Asynchronous
 parallel execution Process order Update inventory Ship order Estimate delivery
  6. 6. Reactive programming Reactive programming focuses on building decoupled scalable and resilient services. Reactive APIs make it easy to call other services asynchronously and in parallel, especially in a microservice architecture. 6@PeterHilton •
  7. 7. Parallel book publication
  8. 8. Reactive Manifesto ‘A reactive system must react to: 1. its users (responsive) 2. failure and stay available (resilient) 3. variable load conditions (elastic) 4. inputs (message-driven)’ 9@PeterHilton •
  9. 9. Parallel execution Reduces latency to the maximum latency of a set of tasks instead of the sum of latencies Uses non-blocking Future-based APIs, available in more languages than you’d expect* * including Visual Basic 10@PeterHilton •
  10. 10. // Start parallel task execution: val inventory: Future[Inventory] = updateStock() val shipment: Future[Shipment] = shipOrder() val delivery: Future[Delivery] = planDelivery() // Complete task execution: val completedOrder: Future[Result] = for (i ← inventory; s ← shipment; d ← delivery) { yield aggregate(i, s, d) }
  11. 11. Future[Delivery] Delivery task complete3. 🕓 planDelivery()1. Future[Delivery] task created2.
  12. 12. Asynchronous execution Non-blocking calls Threads don’t block on async execution Few threads handle many executions Task-oriented orchestration Task completion code is separate from task creation 13@PeterHilton •
  13. 13. Microservices & the orchestration problem
  14. 14. Microservices (µservices) 15@PeterHilton • Network-based service decomposition. Modularisation at deployment unit level Reactive code to coordinate µservice calls. Responsive design mitigates network latency * µ = U+00B5 MICRO SIGN, Option-M (macOS)
  15. 15. ⚙ ⚙ ⚙ ⚙ ⚙ Service orchestration Validate order Notify customer Update inventory Estimate delivery Ship order ⚙ Process order
  16. 16. ⚙ ⚙ ⚙ Validate order Update inventory Ship order Centralised orchestration
  17. 17. Microservice orchestration You need to coordinate microservices calls, 
 at the application level, figure out where the data goes, and where errors happen 18@PeterHilton •
  18. 18. The orchestration problem 19@PeterHilton • Code that coordinates microservices calls: lacks flexibility, and always gets messy. You end up with callback hell, or more advanced solutions like: Reactive Extensions - Rx.NET/, or complex functional types
  19. 19. Orchestrating service calls using workflow
  20. 20. ⚙ ⚙ ⚙ ⚙ Order processing example Process order Update inventory Ship order Estimate delivery
  21. 21. Business process 
 model parallel fork exclusive
  22. 22. Business process 
 model parallel forkexclusive fork (conditional)
  23. 23. Workflow systems and automation Workflow management is 
 process-centric programming. Workflow management systems provide a platform for process execution. Automation involves integration with external systems. 24@PeterHilton •
  24. 24. Workflow for service orchestration 25@PeterHilton • Workflow systems give developers a way to orchestrate service calls. Workflow automation offers two key benefits over conventional application code: 1. persistent execution state 2. graphical process representation.
  25. 25. Persistent execution state Workflow makes execution state persistent (like continuations) This makes the whole system more resilient 26@PeterHilton •
  26. 26. Graphical representation
  27. 27. Graphical representation Workflow gives you an editable graphical representation of the orchestration This process model that makes it easy to see and change how the web services interact. 28@PeterHilton •
  28. 28. Modern workflow platforms Traditional workflow systems are based on fixed processes that integrate with monolithic enterprise IT systems. Modern workflow tools support iterative process development and lightweight integration using JavaScript, JSON and HTTP. 29@PeterHilton •
  29. 29. Does it scale? It won’t run Netflix but could handle orders for the televisions Maersk Line / CC BY-SA 2.0
  30. 30. Workflow execution is reactive Immediate response to workflow state queries (responsive, elastic) Execution failures are isolated (resilient) Persistent execution state (resilient) Execution is triggered by events (message-driven) 31@PeterHilton •
  31. 31. Workflow & the missing ingredient for µservices
  32. 32. Microservice calls
  33. 33. µ-service coordination using workflow Process steps are Service Tasks that call µservices. The process model orchestrates execution and persistent data. The execution platform manages versioning, deployment, multiple executions, reporting… This is another way of programming µservices 34@PeterHilton •
  34. 34. Franklin Heijnen / CC BY-SA 2.0 Human tasks
  35. 35. Human workers as µ-services Process steps can also be Human Tasks, such as filling in a form, assigned to a person. In a workflow system, a human task has the same API as µservice call. By adding Human Tasks to process models, you can program human actors. 36@PeterHilton •
  36. 36. Human task coordination using workflow Some process models only contain Human Tasks. With human processes, workflow systems become collaboration platforms. Process management == people management 37@PeterHilton •
  37. 37. Strict order rejection
  38. 38. 39@PeterHilton • Alan Clark / CC BY-ND 2.0 call centre human
  39. 39. Manual correction
  40. 40. Alan Clark / CC BY-ND 2.0 task escalation
  41. 41. Disadvantages Development and testing Workflow management systems have limited automated testing capabilities (for now) Vendor-specific process description Process models are only partly standardised Graphical models don’t integrate with traditional developer tools 42@PeterHilton •
  42. 42. Conclusion
  43. 43. Conclusion Workflow automation tools provide a convenient solution for µservice orchestration Workflow engines are reactive, reactive programming is cool, so workflow is cool Workflow automation includes human tasks, so you can also program the humans! You don’t necessarily want to really do this :) 44@PeterHilton •
  44. 44. @PeterHilton