distributed systems
play

distributed systems @berndruecker With thoughts from - PowerPoint PPT Presentation

Complex event flows in distributed systems @berndruecker With thoughts from http://flowing.io @berndruecker | @martinschimak 3 common hypotheses I check today: # Events decrease coupling # Orchestration needs to be avoided # Workflow engines


  1. Complex event flows in distributed systems @berndruecker With thoughts from http://flowing.io @berndruecker | @martinschimak

  2. 3 common hypotheses I check today: # Events decrease coupling # Orchestration needs to be avoided # Workflow engines are painful

  3. Bernd Ruecker Co-founder and Developer Advocate of Camunda Berlin, Germany bernd.ruecker@camunda.com @berndruecker

  4. Simplified example: dash button Photo by 0xF2, available under Creative Commons BY-ND 2.0 license. https://www.flickr.com/photos/0xf2/29873149904/

  5. Three steps …

  6. Who is involved? Some bounded contexts … Checkout Shipment Payment Inventory

  7. (Micro-)services Checkout Shipment Payment Inventory

  8. Autonomous (micro-)services Checkout Dedicated Application Processes Dedicated infrastructure Shipment Payment Dedicated Development Teams Inventory

  9. Events decrease coupling

  10. Example The button blinks if we can ship within 24 hours Checkout Shipment Payment Inventory

  11. Request/response: temporal coupling The button blinks if we can ship within 24 hours Checkout Response Request Shipment Payment Inventory

  12. T emporal decoupling with events and read models The button blinks if we can ship within 24 hours Checkout Read Model Good Good Fetched Stored Shipment Payment Inventory *Events are facts about what happened (in the past)

  13. Events can decrease coupling* *e.g. decentral data-management, read models, extract cross-cutting aspects

  14. Peer-to-peer event chains Order placed Checkout Shipment Payment Inventory Goods shipped Payment Goods received fetched

  15. Peer-to-peer event chains Order placed Checkout Shipment Payment Inventory Goods shipped Payment Goods received fetched

  16. 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

  17. 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

  18. 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

  19. Peer-to-peer event chains Fetch the goods before the Order payment placed Checkout Shipment Payment Inventory Goods shipped Payment Goods received fetched

  20. Peer-to-peer event chains Fetch the goods before the Order payment placed Checkout Shipment Payment Inventory Goods shipped Payment Goods received fetched

  21. Peer-to-peer event chains Fetch the goods before the Order payment placed Customers can Checkout pay via invoice … Shipment Payment Inventory Goods shipped Payment Goods received fetched

  22. Photo by born1945, available under Creative Commons BY 2.0 license.

  23. Extract the end-to-end responsibility Order placed Checkout Retrieve Order payment Payment Shipment Payment received Inventory *Commands have an intent about what needs to happen in the future

  24. Commands help to avoid (complex) peer-to-peer event chains

  25. Orchestration needs to be avoided

  26. Smart ESB-like middleware Order Checkout Order placed Payment received Good Shipment fetched Payment Inventory Good shipped

  27. Dumb pipes Checkout Order Martin Fowler Smart endpoints Shipment Payment and dumb pipes Inventory

  28. Danger of god services? Checkout Order Sam Newmann A few Shipment smart god services Payment tell Inventory anemic CRUD services what to do

  29. Danger of god services? Checkout Order Sam Newmann A few Shipment Payment smart god services Inventory tell anemic CRUD services what to do

  30. A god service is only created by bad API design!

  31. Example Retrieve Payment Order Payment

  32. Example Retrieve Payment Credit Order Payment Card

  33. Example Retrieve Payment Credit Order Payment Card Rejected

  34. Example Retrieve Payment Credit Order Payment Card Rejected If the credit Rejected card was rejected, the customer can provide new details Client of dumb endpoints easily become a god services.

  35. Who is responsible to deal with problems? Retrieve Payment Credit Order Payment Card If the credit Rejected card was rejected, the customer can provide new Payment details Payment received failed

  36. Who is responsible to deal with problems? Retrieve Payment Credit Order Payment Card If the credit Rejected card was Smart endpoints are rejected, the potentially long-running customer can provide new Payment details Payment received failed Clients of smart endpoints remains lean.

  37. Photo by Tookapic, available under Creative Commons CC0 1.0 license.

  38. „ There was an error while sending your boarding pass“

  39. Current situation Web-UI Me Check-in

  40. Current situation Web-UI Me Check-in Barcode Output Generator Mgmt

  41. Current situation Web-UI Me Check-in Barcode Output Generator Mgmt

  42. Current situation – the bad part Web-UI Me Check-in Barcode Output Generator Mgmt

  43. Current situation – the bad part Web-UI Me Check-in Barcode Output Generator Stateful Mgmt Retry

  44. We are having some technical difficulties and cannot present you your boarding pass right away. But we do actively retry ourselves, so lean back, relax and we will send it on time.

  45. Possible situation – much better! Web-UI Me Check-in Barcode Output Generator Mgmt

  46. Possible situation – much better! Web-UI Stateful Retry Me Check-in Barcode Output Generator Mgmt

  47. Possible situation – much better! Web-UI Stateful The failure Retry never leaves Me Check-in this scope! Barcode Output Generator Mgmt

  48. Handling State Persist thing State machine or (Entity, Actor, …) workflow engine DIY = effort, T ypical Scheduling, Versioning, accidental concerns operating, visibility, complexity scalability , …

  49. Workflow engines are painful Complex, proprietary, heavyweight, central, developer adverse, …

  50. Avoid the wrong tools! Low-code is great! (You can get rid of your developers!) Death by properties panel Complex, proprietary, heavyweight, central, developer adverse, …

  51. Workflow engines, state machines It is relevant in modern architectures

  52. Workflow engines, CADENCE state machines Silicon valley has recognized

  53. Workflow engines, CADENCE state machines

  54. Workflow engines, CADENCE state machines also at scale

  55. Workflow engines, CADENCE state machines for todays demo

  56. public static void main(String[] args) { ProcessEngine engine = new StandaloneInMemProcessEngineConfiguration() .buildProcessEngine(); engine.getRepositoryService().createDeployment() // .addModelInstance("flow.bpmn", Bpmn.createExecutableProcess("flow") // .startEvent() .serviceTask("Step1").camundaClass(SysoutDelegate.class) What do I mean by .serviceTask("Step2").camundaClass(SysoutDelegate.class) .endEvent() .done() „ leightweight ?“ ).deploy(); engine.getRuntimeService().startProcessInstanceByKey( "flow", Variables.putValue("city", "New York")); } public class SysoutDelegate implements JavaDelegate { public void execute(DelegateExecution execution) throws Exception { System.out.println("Hello " + execution.getVariable("city")); } }

  57. public static void main(String[] args) { Build engine ProcessEngine engine = new StandaloneInMemProcessEngineConfiguration() in one line of .buildProcessEngine(); code engine.getRepositoryService().createDeployment() // (using in- .addModelInstance("flow.bpmn", Bpmn.createExecutableProcess("flow") // memory H2) .startEvent() .serviceTask("Step1").camundaClass(SysoutDelegate.class) .serviceTask("Step2").camundaClass(SysoutDelegate.class) .endEvent() .done() ).deploy(); engine.getRuntimeService().startProcessInstanceByKey( "flow", Variables.putValue("city", "New York")); } public class SysoutDelegate implements JavaDelegate { public void execute(DelegateExecution execution) throws Exception { System.out.println("Hello " + execution.getVariable("city")); } }

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend