Successfully reported this slideshow.

Master the flow of microservices - because your business is more complex than ...

461 views

Published on

My talk at Voxxed Vienna, talking about that business processes are more complex for most companies than simple models, like e.g. video streaming abos. These challenges can be addresses with Microservices, but you also have to take care about the flow. This talk shows how to do this with a lightweight engine using BPMN as part of your microservices.

Published in: Technology
  • Be the first to comment

Master the flow of microservices - because your business is more complex than ...

  1. 1. @berndruecker#VoxxedVienna Because your business is more complex than * * Some big video streaming company bernd.ruecker@camunda.com With thoughts from http://flowing.io @berndruecker | @martinschimak
  2. 2. FAMGA
  3. 3. FANG
  4. 4. Tech stack https://www.slideshare.net/RaminForood/platform-data-technologies-at-netflix No orchestration.
  5. 5. Orchestration
  6. 6. Netflix recognized challenges in orchestration
  7. 7. Let‘s do some groundwork before we dive into orchestration…
  8. 8. System complexity increases dramatically Warehouse System Logistics Platform Taxi System Travel Platform Insurance System Insurance Platform Heating with temperature sensor Smart Heating (Cloud controlled) … …
  9. 9. Helpful paradigms Microservices Event Driven & Reactive Domain Driven Design
  10. 10. Microservices • Independent components • Independent deployments • Decoupling between components • Dedicated teams to fight conways law • Autonomy of technology decisions • Avoid horizontal team boundaries • New DevOps paradigms Microservice Microservice Microservice Monolith A B C A B C
  11. 11. Event driven microservices Microservice Microservice Microservice A B C Eventbus
  12. 12. Communication via events Microservice Microservice A C Eventbus Event event name payload no receipient
  13. 13. Communication via Events Microservice Microservice A C Eventbus Event Does not know about C Does not know about A
  14. 14. Compare to SOA Service Service A C ESB „smart endpoints and dumb pipes”
  15. 15. Value proposition: fight conway, keep agility and ease changes Microservice Microservice A C Eventbus
  16. 16. Yeah.
  17. 17. Example: Simple order handling
  18. 18. pay receive shipment place order I want to buy this! I am happy!
  19. 19. Sample Microservices Inventory Service Handles Stock, Reserviations and physical handling of goods Payment Service Handles Payment Shipping Service Manage shipments & labels for logistic providers
  20. 20. Eventflow Order Placed Payment Received Goods Picked Goods Shipped InventoryPayment ShippingShop
  21. 21. Implementation
  22. 22. Let‘s zoom in the payment service Payment Service order placed payment received
  23. 23. Let‘s zoom in the payment service Payment Service order placed payment received The payment service has to listen to „order placed“ event
  24. 24. De-coupling? Payment Service order placed service fullfilled … Whenever a new service requires payment, the payment has to be changed Payment has to know all possible events that trigger a payment subscription confirmed
  25. 25. Martin Fowler also recognized Event notification is nice because it implies a low level of coupling, and is pretty simple to set up. It can become problematic, however, if there really is a logical flow that runs over various event notifications. The problem is that it can be hard to see such a flow as it's not explicit in any program text. Often the only way to figure out this flow is from monitoring a live system. This can make it hard to debug and modify such a flow. The danger is that it's very easy to make nicely decoupled systems with event notification, without realizing that you're losing sight of that larger-scale flow, and thus set yourself up for trouble in future years https://martinfowler.com/articles/201701-event-driven.html
  26. 26. Event Command Transformation Payment Service do payment order placed Transformation Command Something has to happen in the future 1 recipient Event Something has happend in the past 0..n recipients
  27. 27. This calls for an order service Payment service do payment order placed Order service
  28. 28. Microservices Inventory service Payment service Order service Does event command transformation for orders Shipping service
  29. 29. Event Command Transformation do payment order placed Order Service payment received pick goods goods picked ship goods goods shipped order delivered Order Service Order Service Order Service
  30. 30. Smeels like a central ESB? http://apsblog.burtongroup.com/2009/01/soa-is-dead-long-live-services.html
  31. 31. No! Far from it! Inventory service Payment service Order service Might be implemented in simple Java Shipping service
  32. 32. Order service does the orchestration
  33. 33. Implementation (with event command transformation)
  34. 34. Some things in life are slow do payment order placed payment received pick goods goods picked ship goods goods shipped order delivered Order Service Long Running Long Running Long Running Long Running
  35. 35. You also have to handle state.
  36. 36. Bernd Rücker Co-founder Camunda > 10+ years workflow http://bernd-ruecker.com/ bernd.ruecker@camunda.com Camunda Open source vendor Berlin + San Francisco > 60 employees No venture capital www.camunda.org
  37. 37. The 7 sins of workflow and Java Homegrown engine No engine Wrong engine 4 6 5 7 All sins: http://blog.bernd-ruecker.com/ Zero-code suites Wrong usage
  38. 38. ToolsState Visibility [ Orchestration | Workflow | BPM ] Engine
  39. 39. Order example in BPMN* *BPMN = ISO standard for modeling and execution in this context means:
  40. 40. Payment example
  41. 41. Paymentservice Orchestration is part of the microservices! Orderservice Eventbus
  42. 42. It does not have to be one monlithic process Hint: This might work well if your company is structured to have this one clear process owner for this process.
  43. 43. Microservice vs. BPM community
  44. 44. Requirement: lightweight and embeddable engine Engine must be • easy to use • developer friendly also in the scope of microservices • technically • license model Payment service Order service engine engine … … … … engine
  45. 45. Yes – that‘s possible!
  46. 46. Live Demo
  47. 47. Architecture Inventory service Payment service Order service Shipping service H2 Shop Monitor Camunda Webapp on Tomcat for demo in single Java VM for simplicity
  48. 48. Screenshots
  49. 49. Screenshots
  50. 50. And synchronous communication?
  51. 51. Communication between Microservices Microservice Microservice Microservice A B C e.g. REST You need to handle outtages (wait, retry, …)
  52. 52. Change scenarios
  53. 53. We want to reserve goods even before we received the payment.
  54. 54. Changes Inventory service Payment service Order service Shipping service must provide reservation servicereserve goods at right moment
  55. 55. BPMN
  56. 56. Changes Inventory service Payment service Order service Shipping service must provide reservation servicereserve goods at right moment Listen to goods reserved instead of order created. Listen to order created. With event command transformation Without
  57. 57. VIP customers can order with invoice (and pay later)
  58. 58. Required changes Inventory service Payment service Order service Shipping service Invoice service skip payment, but add open invoice
  59. 59. Responsibility of order service
  60. 60. Required changes Inventory service Payment service Order service Shipping service Invoice service skip payment, but add open invoice Listen to order created VIP or payment received (non VIP). Listen to order created (VIP).
  61. 61. We need more cool stuff – can BPMN do this?
  62. 62. Compensation …in case of errors in error handling pay the money back to the customer
  63. 63. Timeouts …after two weeks pricing is not binding any more
  64. 64. When a customer cancels, we want to win him back!
  65. 65. Required changes Inventory service Payment service Order service Shipping service Listen to appropriate events, no change anywhere else Winback service BPM monolith
  66. 66. Summary • Microservices and event driven architecture go well together • You need an event command transformation • If the translation is stateful, consider using an appropriate engine • Modern lightweight engines foster and not hinder these architectures
  67. 67. Is it for me? Isn‘t all of that just for FANG?
  68. 68. With thoughts from http://flowing.io @berndruecker | @martinschimak
  69. 69. https://github.com/flowing
  70. 70. Slides online at http://bernd-ruecker.com
  71. 71. Thank you! Any questions?

×