Skip to main content

Event Sourcing & CQRS

  • If using event sourcing, you must use CQRS (separating command functions from query functions)
  • CQRS = separate functions that write data from ones that read data
  • Command = function that has a side effect (writes/mutates) and returns void
  • Query = function that returns data (reads) and has no side effects
  • One of the things that’s harder with event sourcing is querying your data (how many users are named “greg”?)
  • The talk implied CQRS can solve that problem, but didn’t specify how

Original video by Code on the Beach:

Watch Greg Young’s talk “CQRS and Event Sourcing” from Code on the Beach 2014 at One Ocean Resort & Spa, Atlantic Beach, Florida. Saturday, August 9, 2014. www.codeonthebeach.com

Abstract:
“Looking at mature domains it is odd that almost none have a concept of current state but instead are built off a set of facts that occurred; is your bank balance a column in a table? This is not by accident and there are many benefits to having this viewpoint of a system both from a business and a technological viewpoint. In this talk we will look at what cqrs (command and query responsibility segregation) and event sourcing are.”