Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

An example CQRS implementation in the Ruby language

branch: master
README.md

Aftermath

An example (and work in progress) Ruby implementation of CQRS (Command and Query Responsibility Segregation) as a reference for a session at SAPO Codebits 2010

Conceptual View

Implementation notes

A simple e-commerce / fulfillment Domain implementation with the bare minimum of framework infrastructure.

Directory layout :

  • lib/aggregates - aggregates with public behavior methods and private event handlers
  • lib/command_handlers - example
  • iib/commands - commands (behaviors, task, intent)
  • lib/domain - supporting domain code, mostly value objects
  • lib/events - events (history of intent)
  • lib/framework - infrastructure
  • lib/reporting - read / query model - one per UI screen

Please refer to inline notes in /lib/framework in the interim whilst this README's being prepared.

Caveats

A few very important details has been overlooked in favor of demonstrating patterns without noise of technical masturbation.

  • Simple in process pub/sub channels
  • In memory sqlite backend for Event Storage
  • Hash repository for the Query / Reporting side
  • Duck typing for Command and Event handlers as Ruby doesn't have a formal type system
  • No coercion or validation for messages (Commands and Events)
  • No UI components (I might introduce a light Rack or Sinatra one)

How to run the test suite

git clone git@github.com:methodmissing/aftermath.git
cd aftermath
bundle install
rake

CQRS resources

Something went wrong with that request. Please try again.