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

W-JAX 2017: Spring Boot Microservices mit Domain Events

W-JAX 2017: Spring Boot Microservices mit Domain Events

Domain Events sind ein zentraler Aspekt des taktischen Domain-driven Designs und zudem noch die Basis für die Implementierung lose gekoppelter Microservices, die auf asynchrones Event Processing ausgelegt sind. In diesem Vortrag werden wir uns mit dem Konzept der Domain Events beschäftigen und kennen lernen, wie sie modelliert und genutzt werden können, um eine lose Kopplung ohne synchrone Kommunikation von Microservices erreichen zu können.
Weiterhin werden wir das Konzept anhand eines konkreten Beispiels in die Praxis umsetzen. Hierbei werden wir Technologien wie Spring Boot, Spring Cloud Stream (Rabbit/Kafka) und Cloud Foundry verwenden, um anhand von Events und unterschiedlichen Modellierungsstilen von Events die Vor- und Nachteile des Ansatzes kennen zu lernen.

Michael Plöd

November 07, 2017
Tweet

More Decks by Michael Plöd

Other Decks in Programming

Transcript

  1. Your Trainer: Michael Plöd > Principal Consultant at innoQ >

    Regular Conference Speaker > Domain-Driven Design Practitioner since 2006 > Twitter: @bitboss > GitHub: https://github.com/mploed
  2. „After inserting data into“ „We need to check the status

    of“ „When we have called System X“ „If that happens“ „After the customer has“ „Notify me if“
  3. Events are easy to grasp Events have a simple semantic

    Events can be placed 
 on a timeline
  4. An event is something 
 that happened in the past

    t now Event Event Event Event Event
  5. Commands can change business object 
 state. Which can result

    in one or more Events being published Command Business
 Object Event Event Event
  6. Options for Event Payload Options Full Payload The event carries

    complete Entitiy-Graphs or Aggregates Mix The event contains data that is usually of interest to many other contexts. For special purposes there is also a URL to a RESTful HTTP Ressource Empty The event is empty or contains only minimal data and is being used to trigger pulling from a feed (eg. Atom) REST URL The event only carries a URL to a RESTful HTTP Ressource
  7. CustomerCreatedEvent { "eventId": "4567854", "eventTimetamp": „12398989343", "eventType": "CustomerCreatedEvent", "customerName": "Michael",

    "customerLastName": "Plöd", "customerNumber": "34ed2345", "address" : { "street": "Kreuzstr. 16", "postCode": "80331", "city": "München" } } Full Payload Events contain full object graphs Consumers do have all the data
 they need „Invitation“ to a high degree of
 coupling between event and
 consumer
  8. CustomerCreatedEvent { "eventId": "4567854", "eventTimetamp": „12398989343", "eventType": "CustomerCreatedEvent", "url": "http://123.03.24.23/event/2"

    } REST URL Events only contain a URL to a REST resource for the event data If consumers need the data they can obtain it but don’t have to Synchronous communication, but 
 no service discovery
  9. CustomerCreatedEvent { "eventId": "4567854", "eventTimetamp": „12398989343", "eventType": "CustomerCreatedEvent", } Empty

    Events contain no data at all Consumers would usually 
 consume an (ATOM) Feed Consumers need to know the 
 Source of the Feed
  10. CustomerCreatedEvent { "eventId": "4567854", "eventTimetamp": „12398989343", "eventType": "CustomerCreatedEvent", "customerLastName": "Plöd",

    "customerNumber": "34ed2345", "url": "http://123.03.24.23/event/2"
 } MIX Events contain some data Additional data can be obtained 
 by calling as REST Resource Good compromise in many 
 occasions
  11. An event is something 
 that happened in the past

    t now Event Event Event Event Event
  12. NO

  13. NO

  14. NO

  15. Event Sourcing is an architectural pattern in which the state

    of the application is being determined by a sequence of events
  16. THANK YOU I’ll post links to slides and code on

    Twitter
 Michael Plöd - innoQ @bitboss