Sandthorn/sandthorn — pull request #17 by jesjos (2014-10-22 14:44:49+00:00)
Title: Feature/named event stores

# Why?
- Presently, if you have more than one event store and call `Sandthorn.get_events` providing no aggregate types or aggregate types from different event stores, an error will be raised. This behaviour makes it harder to write projection modules. You want to be able to just get all events from any given event store.

# What's included
## A new way of configuring Sandthorn
### Set event stores:

```ruby
# One event store
driver = SandthornDriverSequel.driver_from_url(url: some_url)
Sandthorn.configure do |sand|
sand.event_store = driver
end

# Several event stores
other_driver = SandthornDriverSequel.driver_from_url(url: some_other_url)
Sandthorn.configure do |sand|
sand.event_stores = {
default: driver,
other_store: other_driver
}
end
```

## Set `event_store` for an aggregate
``` ruby
class MyAggregate
include AggregateRoot
event_store :other_store
end
```
Aggregates with no explicit store will use the default store.

## New behaviour in `Sandthorn.get_events`

Accepts a `event_store` option. Defaults to the default event store.

``` ruby
MyAggregate.new.save
Sandthorn.get_events(aggregate_types: [MyAggregate])
# => no events
Sandthorn.get_events(event_store: :other_store, aggregate_types: [MyAggregate])
# => events
```

# Remaining issues
- Since we store the `event_store` in the aggregate class, we need the actual class, and not just strings, for aggregate types. This is probably a braking change. I guess we could try constantizing the arguments if they don't respond to `:event_store`.