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

Exploring Alternatives to CRUD apps with CQRS a...

Exploring Alternatives to CRUD apps with CQRS and Event Sourcing

Ever wonder what your web app might look like if you choose not to build a CRUD app? This talk will explore alternatives to CRUD by examining concepts of domain driven design, along with CQRS and event sourcing. We will dive into specific examples with the Axon framework for Java. This talk will compare and contrast CRUD applications to CQRS style architectures and what their application can look like when combined with domain driven design and event sourcing. We will go over the benefits as well as some of the complexities and challenges encountered when using this pattern.

Amber Houle

October 18, 2016
Tweet

Other Decks in Programming

Transcript

  1. ➔ What is CQRS? ➔ Event Sourcing + CQRS +

    DDD ➔ Some of the benefits ➔ Demo time ➔ What to watch out for - complexities
  2. ➔ Large financial institution Experience with CQRS + Event Sourcing

    ➔ > 70 people ➔ ~ 7 teams ➔ Distributed across 2 continents
  3. Twitter 300K requests / s reads 6k requests / s

    writes vs 50x more reads than writes http://highscalability.com/blog/2013/7/8/the-architecture-twitter-uses-to-deal-with-150m-active-users.html
  4. ➔ Audit Log? Analytics? ➔ Capturing the users intent ➔

    De-coupling write and read operations
  5. Presentation Layer Domain Logic / Command Model Data Access /

    Query Model Command Query Datastore Datastore
  6. “Event Sourcing ensures that all changes to application state are

    stored as a sequence of events.” - Martin Fowler
  7. UI Command Query Command Command Handler Aggregate Root Event Event

    Listener Datastore Read Side Model Query Datastore
  8. Benefits of CQRS + Event Sourcing + DDD ➔ Immutable

    Event Store ◆ Built in Audit Logs ◆ Replayable events to re-build current state ➔ Ubiquitous language ➔ Loose coupling of components ➔ Traceable errors
  9. In the real world, our actions extend beyond creating, reading,

    updating and deleting things. So why limit the way we design software to these four actions?
  10. ➔ Suitable with complex business domain Things to keep in

    mind... ➔ Scalability of read operations ➔ Built in audit logs ➔ Does not need to be used in all components of your system!
  11. Upcasting “Is the mechanism used to convert deprecated (typically serialized)

    objects and convert them to the current format” - Axon Docs
  12. ➔ Event replay in practice ➔ Eventual Consistency ➔ Upcasting

    Other things to watch out for... ➔ Not as many tools & resources
  13. References ➔ http://martinfowler.com/bliki/DDD_Aggregate.html ➔ CQRS and Event Sourcing - Greg

    Young ◆ https://www.youtube.com/watch?v=JHGkaShoyNs ➔ Avoiding monolith applications with Axon Framework - Trifork ◆ https://www.youtube.com/watch?v=g2A_e9jH0No ➔ Axon 3 Live Coding Webinar - Trifork ◆ https://www.youtube.com/watch?v=s2zH7BsqtAk