Strange Loop

2009 - 2023

/

St. Louis, MO

Commander: Better Distributed Applications through CQRS and Event Sourcing

Have you ever hit a wall with REST? Does modeling your problem domain into CRUD-able entities feel like fitting a square peg into a round hole? Perhaps instead of modeling our services like little databases, we should instead model them like reactors over immutable event streams.

REST APIs are great, but their typical implementation tightly couples various concerns that would be better separated:

Commander is:

  1. A pattern for writing distributed applications that de-couples these concerns using ideas from CQRS and Event Sourcing, thereby alleviating common frustrations with CRUD-flavored REST
  2. An implementation of the core component in this pattern using Clojure in the HTTP layer, using Java with the new Kafka Streams library in the event stream processing layer, and using Datomic for persistence

The Commander pattern imposes a clear separation of action from perception, and uses immutable values conveyed by Kafka and the Kafka Streams library to separate business logic from HTTP request processing, all while preserving the historical narrative of the entire event stream.

In this talk, I'll discuss the benefits and tradeoffs of applying this pattern in an enterprise context, and demonstrate my implementation under load.

Bobby Calderwood

Bobby Calderwood

Capital One

Bobby is a member of the Technology Fellows team at Capital One, where he designs and develops solutions to difficult problems, influences the technical direction of Capital One while helping development teams implement that technical direction, and engages the broader technical community via speaking and open-source contribution. Prior to joining Capital One, Bobby was Director of Product Engineering at B23 LLC, a startup working on enabling big data solutions in cloud environments. Before B23, Bobby worked on the Product Team at Cognitect building, testing, and helping customers win with Datomic. Bobby's been writing web applications and distributed systems with Clojure and ClojureScript since 2010, and before that in Java, Ruby and Rails, and client-side techs since 2006.