HistoryBook is a ruby implementation of the event sourcing pattern.
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.travis.yml
CODE_OF_CONDUCT.md
Gemfile
LICENSE
README.md
Rakefile
history_book.gemspec

README.md

HistoryBook Build Status

HistoryBook is a ruby implementation of the event sourcing pattern.

This library provides an interface for event sourcing over a pluggable back end data store. Currently it supports the Sequel gem and its data stores as well as an in-memory data store for testing.

Usage

To run the example below you will need to install (or place in your Gemfile) both the sequel gem and the pg gem.

HistoryBook.configure(:sequel) do |config|
  config.connection_string = 'postgres://localhost/history_book'
end

HistoryBook.open('test_id') do |stream|
  stream << HistoryBook::Event.new(:customer_created, :name => 'Joe Tester', :address => '100 West Washington')
  stream.commit
end

HistoryBook.open('test_id') do |stream|
  stream.events.each do |event|
    puts "Playback event #{event.type} with #{event.data.inspect}"
  end
end