I’m trying to wrap my head around CQRS (Command Query Response Separation) per Martin Fowlers recent post at:
http://martinfowler.com/bliki/CQRS.html
Given a project:
Main Database (Postgres):
Product has many Sales
User has many Sales
Reporting Database (NoSQL - Mongodb)
Transaction (A Product and a Sale and a User)
And a requirement of producing a chart of transaction dollars per day for a given month.
- What controllers would I need for reporting?
- A Reports controller for views and partials
- A Graphs controller for pulling the specific info for a graph out of the Reporting DB?
- What the heck would the DTO (Data-Transfer Object) be in this case?
- Is this really CQRS?
- I assume so, since Reports/Graphs created from reporting DB would not be changing state, just a view on the main DB?
Thanks!
If you’re still interested in investigating CQRS with Rails have a look at rcqrs a Ruby CQRS with Event Sourcing library I created.
There’s also a Rails 3 plugin to integrate with your Rails app that comes with generators to ease common tasks for creating commands, events and controllers using the CQRS pattern.
Finally, there is a very simple sample blog Rails application to look at how you might use CQRS with Rails (look at my GitHub account for more details).