@pawelpacana pawelpacana released this Sep 27, 2018 · 56 commits to master since this release

Assets 2

RailsEventStore

  • Change: Deprecate RailsEventStore::ActiveJobDispatcher and RailsEventStore::ActiveJobDispatcher::ActiveJobScheduler. Read RubyEventStore changelog below to learn how to use new dispatchers, and use new RailsEventStore::ActiveJobScheduler scheduler.

  • Change: Deprecate RailsEventStore::AsyncProxyStrategy::AfterCommit. Use AfterCommitAsyncDispatcher instead.

  • Change: RailsEventStore default dispatcher has now changed to use new dispatchers, but still preserving old overall behaviour (dispatch asynchronous if possible, synchronous otherwise)

  • Add: Instrumentation for dispatchers. Read more in docs for an overview and list of available hooks. [#455, #244]

    regular_dispatcher = 
      RubyEventStore::ComposedDispatcher.new(
        RubyEventStore::ImmediateAsyncDispatcher.new(scheduler: ActiveJobScheduler.new),
        RubyEventStore::PubSub::Dispatcher.new
      )
    instrumented_dispatcher = 
      RubyEventStore::InstrumentedDispatcher.new(
        dispatcher, 
        ActiveSupport::Notifications
      )
    
    name = "call.dispatcher.rails_event_store"
    ActiveSupport::Notifications.subscribe(name) do |name, start, finish, id, payload|
      metric = ActiveSupport::Notifications::Event.new(name, start, finish, id, payload)
      NewRelic::Agent.record_metric('custom/RES/dispatch', metric.duration)
    end
  • Add: Instrumentation for repositories. Read more in docs for an overview and list of available hooks. [#423, #244]

    repository = RailsEventStoreActiveRecord::EventRepository.new
    RubyEventStore::Client.new(
      repository: InstrumentedRepository.new(repository, ActiveSupport::Notifications)
    )
    
    name = "append_to_stream.repository.rails_event_store"
    ActiveSupport::Notifications.subscribe(name) do |name, start, finish, id, payload|
      metric = ActiveSupport::Notifications::Event.new(name, start, finish, id, payload)
      NewRelic::Agent.record_metric('custom/RES/append_to_stream', metric.duration)
    end
  • Remove: Deprecated read API has been finally removed. [1778b3c]

  • Remove: Dead initializer argument page_size: removed. [d179a3b]

RubyEventStore

  • Fix: Enclosed SRecord into RubyEventStore namespace [#394].

  • Change: Deprecate old AsyncDispatcher and AsyncProxyStrategy::Inline. Now if you want to have only asynchronous inline dispatch, you can use ImmediateAsyncDispatcher. If you want to have old behaviour (both async and sync dispatcher), use ComposedDispatcher.new(ImmediateAsyncDispatcher.new(scheduler: scheduler), PubSub::Dispatcher.new)

  • Change: Dispatchers should no longer raise errors on verify, but return true/false instead. It is especially important if you want to use new ComposedDispatcher, not relevant otherwise.

  • Change: Schedulers API for new dispatchers change, it now use verify instead of async_handler? to verify whether handler is correct for given scheduler.

  • Add: ComposedDispatcher — new dispatcher, which accepts at least one dispatcher and dispatch the event to the first dispatcher which accepts the subscriber.

  • Add: Linter for schedulers.

  • Fix: RubyEventStore::InvalidHandler now does not return very customized (and often wrong) error message, it's now simple error inheriting on StandardError.

  • Add: RubyEventStore::Specification#first and RubyEventStore::Specification#last. That allows more idiomatic reading of edge events over frequently used enumerator-to-array conversion of even_store.read.each.to_a.last. [#399]

    first_event_in_dummy_stream = event_store.read.stream("Dummy").first
    last_event_published        = event_store.read.last
  • Fix: Ensure immutability in RubyEventStore::Specification result passed to repository. [#416]

  • Change: RubyEventStore::Client#publish, RubyEventStore::Client#append and RubyEventStore::Client#delete_stream return self instead of :ok. That is more useful in happy path as it allows chaining. [#413]

  • Add: RubyEventStore::Client#streams_of new API to get a list of all streams where event of given id is stored or linked. [#452]

  • Remove: Deprecated RubyEventStore::MethodNotDefined const is no more. [60cf00d]

  • Remove: Deprecated read API has been finally removed. [1778b3c]

  • Remove: Dead initializer argument page_size: removed. [d179a3b]

  • Change: Refactor RubyEventStore::Specification & RubyEventStore::SpecificationResult. RubyEventStore::Specification is just a builder of RubyEventStore::SpecificationResult that is passed to event repository. [#417] Closes [#398]

  • Add: RubyEventStore#overwrite(events) to overwrite the events which were already stored -- useful when events schema changes. Requires repository to implement update_messages(events) method.

RailsEventStoreActiveRecord

  • Add: Introduce PgLinearizedEventRepository. This repository uses lock (released at the end of a transaction) to guarantee only one batch of events written concurrently. More on its rationale and limitations can be found in docs [#106, #403].

  • Remove: V1-to-V2 schema migration code is now hosted in rails_event_store_active_record-legacy gem. [#412, #333]

  • Add: support for streams_of - fetching a list of streams where event of given id is stored or linked [#441]

  • Add: support for overwriting events feature. For details, read changelog of RubyEventStore.

AggregateRoot

  • no changes

RailsEventStore::RSpec

  • no changes

BoundedContext

  • no changes

RailsEventStore::Browser

  • Add: Display event data and metadata in collapsible tree widget. [#414]
  • Change: Deprecate rails_event_store-browser gem. This has been replaced by ruby_event_store-browser which works not only with Rails, but also any other Rack-based app. To be removed on next release.

RubyEventStore::Browser

First release of rails_event_store-browser successor. This Browser has the same functionality but offers much wider applicability, beyond Rails. It can be used as a standalone app or mounted inside existing one.

In Rails:

Rails.application.routes.draw do
  mount  RubyEventStore::Browser::App.for(
    event_store_locator: -> { Rails.configuration.event_store },
    host: 'http://localhost:3000',
    path: '/res'
  ) => '/res' if Rails.env.development?
end

Standalone config.ru:

require 'ruby_event_store/browser/app'

event_store = RubyEventStore::Client.new(
  repository: RubyEventStore::InMemoryRepository.new
)

run RubyEventStore::Browser::App.for(
  event_store_locator: -> { event_store },
  host: 'http://localhost:4567'
)

See browser docs for more.

RubyEventStore::ROM

  • Add: support for streams_of – fetching a list of streams where event of given id is stored or linked [#441]

RailsEventStoreActiveRecord::Legacy

  • Add: Host V1-to-V2 schema migration code. [#412, #333]

  • Add: support for streams_of – fetching a list of streams where event of given id is stored or linked [#441]