event driven microservices
play

Event Driven Microservices The sense, the non-sense and a way - PowerPoint PPT Presentation

Event Driven Microservices The sense, the non-sense and a way forward @allardbz Once upon a time @allardbz Universal BBC architecture Box Box Cylinder Source: Ted Neward @allardbz Source:


  1. Event Driven Microservices The sense, the non-sense and a way forward @allardbz

  2. Once upon a time… @allardbz

  3. “Universal ‘BBC’ architecture” Box Box Cylinder Source: Ted Neward @allardbz

  4. Source: http://www.sabisabi.com/images/DungBeetle-on-dung.JPG @allardbz

  5. Microservices to the rescue! @allardbz

  6. Why microservices? @allardbz

  7. Agility (Team) Scalabilty @allardbz

  8. Additional Agility Scalability Complexity @allardbz

  9. “Universal Microservices architecture” @allardbz

  10. Noun Driven Design Noun? → Service! @allardbz

  11. Noun Driven Design OrderService @allardbz

  12. Noun Driven Design CustomerService @allardbz

  13. Noun Driven Design ProductService @allardbz

  14. Noun Driven Design InventoryService @allardbz

  15. “Evil anti - modularity forces” Modularity Number of deployment units @allardbz

  16. @allardbz

  17. Want to build microservices? Learn to build a decent monolith first! @allardbz

  18. $ @allardbz

  19. Location transparency A component should neither be aware of nor make any assumptions about the location of components it interacts with. A Component should not be aware, nor make any assumptions, of the location of Components it Location transparency starts with good API design interacts with (but doesn’t end there) @allardbz

  20. Events @allardbz

  21. Service B Service A Service C Service D @allardbz

  22. Service B Service A Service C Event Service D @allardbz

  23. “Event” all the things! @allardbz

  24. Maslow’s Hammer @allardbz

  25. Birmingham Screwdriver @allardbz

  26. “Maslow Syndrome” @allardbz

  27. Event Notification Event-carried State Transfer Event Sourcing @allardbz

  28. ‘Event - Driven’ Microservices OrderCreated → ItemAdded → ItemRemoved → OrderConfirmed → Need to know Order service ordered items @allardbz

  29. Or worse… OrderCreated →  InventoryConfirmed  ReadyForPayment OrderPaid → ReadyForShipping →  OrderShipped Shipping Payment service Order service Service @allardbz

  30. Microservices Messaging Queries Commands Events Route to single handler Route with load balancing Distribute to all logical handlers Use consistent hashing Sometimes scatter/gather Consumers express ordering req’s Provides confirmation/result Provides result No results "Event" and “Message" is not the same thing @allardbz

  31. ‘Event - Driven’ Microservices OrderCreated → ItemAdded → OrderConfirmed → ItemRemoved →  GetOrderDetails OrderConfirmed → OrderDetails → Need to know Order service ordered items @allardbz

  32. Event Sourcing: the truth, the whole truth, nothing but the truth @allardbz

  33. Event Sourcing State storage Event Sourcing OrderCreated (id: 123) id: 123 ItemAdded (2x Deluxe Chair, €399) items ItemRemoved (1x Deluxe Chair, €399) 1x Deluxe Chair - € 399 OrderConfirmed status: return shipment rcvd OrderShipped OrderCancelledByUser ReturnShipmentReceived @allardbz

  34. Event Sourcing OrderCreated → ItemAdded → ItemRemoved → OrderConfirmed → Some smart Order service analytics @allardbz

  35. Why use event sourcing? Business reasons Technical reasons • Auditing / compliance / • Guaranteed completeness of raised events transparency • Single source of truth • Concurrency / conflict resolution • Data mining, analytics: • Facilitates debugging value from data • Replay into new read models (CQRS) • Easily capture intent • Deal with complexity in models @allardbz

  36. The challenges Dealing with increasing storage size Complex to implement “Event Thinking” @allardbz

  37. Source “Event” all the things! @allardbz

  38. Event store in context Past events Application Event store New events Works well for processing changes on single • entities/aggregates (Commands) Does not work well for generic queries • @allardbz

  39. CQRS Command-Query Responsibility Segregation Past events Command Handler Event store New events New events Projection logic Updates Selection criteria Query Handler Projection database Data @allardbz

  40. “CQRS” all the things? @allardbz

  41. Service Service Service Service Service Service @allardbz

  42. Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service @allardbz

  43. Communication = Contract @allardbz

  44. Service Service Service Service Service @allardbz

  45. Bounded context Explicitly define the context within which a model applies. Explicitly set boundaries in terms of team organization, usage within specific parts of the application, and physical manifestations such as code bases and database schemas. Keep the model strictly consistent within these bounds, but don’t be distracted or confused by issues outside. @allardbz

  46. Service Service Service Service Service Service Service Service @allardbz

  47. Service Anti-corruption layer Service Service Service Service @allardbz

  48. @allardbz

  49. In closing…. @allardbz

  50. Consider commands and queries as much as events @allardbz

  51. Sharing is caring @allardbz

  52. Beware coupling across bounded contexts @allardbz

  53. “Microservice Journey” @allardbz

  54. Monolith first @allardbz

  55. wax-on , wax-off! @allardbz

Recommend


More recommend