Skip to content
This repository has been archived by the owner on Mar 17, 2020. It is now read-only.

jtdowney/history_book

Repository files navigation

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

About

HistoryBook is a ruby implementation of the event sourcing pattern.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages