git clone git@github.com:robinbortlik/rails_event_store_library.git
bundle install
bundle exec rake db:setup
This is experimental project built just for education purposes.
Application implements basic "Library" functions to keep evidence of borrowed and returned books.
App is available on https://rails-event-store-library.herokuapp.com/
All object state changes are handled as events with help of Rails Event Store library
- app
|
- lib
|
- Domain (Books, Users)
|
- Purpose (Models, Events, Commands, Aggregates)
|
- Class/Module name (book.rb, borrow.rb, on_return.rb)
HTTP -> controller#action
-> command_bus(command)
-> aggregate.action
-> event triggered
-> event store updated
-> read_model updated
-
How to correctly design and update the read model, so I do not need to duplicate business logic between aggregate root and read model
-
How read model handles updates on linked objects:
Example:
Book read model
storesUser full name
. User updates his name, shall I subscribe book toUser name changed
event and update the user name stored on the book record?