Skip to content

Releases: RailsEventStore/rails_event_store

v0.18.0

25 Sep 20:02
Compare
Choose a tag to compare

RailsEventStore

  • Add: Support for asychronous event handlers with ActiveJobDispatcher [#103]

ActiveJobDispatcher is a new dispatcher ready to use with RES as a replacement of DefaultDispatcher.
The main improvement is that if a handler class is an ancestor of ActiveJob::Base it will be handled asynchronously.

Comes in two flavours: Inline, which is a default proxy_strategy and AfterCommit.

config.event_store = RailsEventStore::Client.new(
  event_broker: RailsEventStore::EventBroker.new(
    dispatcher: RailsEventStore::ActiveJobDispatcher.new(
      proxy_strategy: RailsEventStore::AsyncProxyStrategy::AfterCommit.new
    )
  )
)

Use RailsEventStore::AsyncProxyStrategy::AfterCommit when your queue is handled by Resque, Sidekiq or in general by different datastore than RailsEventStoreActiveRecord itself.

Use RailsEventStore::AsyncProxyStrategy::Inline when your queue is DelayedJob or any queue using underlying database - same as the one for RailsEventStoreActiveRecord .

As a consequence subscriber can be now just a class:

module Denormalizers
  class OrderSubmitted < ApplicationJob
    queue_as :default

    def perform(*args)
      call(YAML.load(args.first))
    end

    private
    def call(event)
      # implementation
    end
  end
end

Rails.application.config.event_store.tap do |es|
  es.subscribe(Denormalizers::OrderSubmitted, [Events::OrderSubmitted])
end

RubyEventStore

  • no changes

RailsEventStoreActiveRecord

  • no changes

AggregateRoot

  • Change: unpublished_events collection is now public but read-only

RailsEventStore::RSpec

  • Fix: missing release task in Makefile
  • Fix: uninitialized constant RSpec::Matchers when running rake [#115]
  • Fix: undefined method 'failure_message' for HaveApplied [#118]
  • Change: auto-configure RSpec [#120]
  • Change: bump RES in dev dependencies from ~> 0.15.0 to ~> 0.17.0
  • Change: implemented basic failure_message for HavePublished

BoundedContext

  • First release of a gem supporting technical part of separating logical application parts.

Add to Gemfile as following:

gem 'bounded_context`

Now you can launch generator if you're on Rails:

rails g bounded_context:generator inventory 

That would create inventory/lib/inventory.rb

module Inventory
end

It will also make sure code is autoloaded there as long as you stick to require_dependency over regular require. See following blogpost to learn more about this.

module Rails513
  class Application < Rails::Application
    config.paths.add 'inventory/lib', eager_load: true
  end
end

v0.17.0

15 Sep 21:39
dc4a4c1
Compare
Choose a tag to compare

This release adds RailsEventStore::RSpec to the repository.

RailsEventStore

  • no changes

RubyEventStore

  • no changes

RailsEventStoreActiveRecord

  • no changes

AggregateRoot

  • no changes

RailsEventStore::RSpec

  • no changes

v0.16.0

14 Sep 14:16
Compare
Choose a tag to compare

AggregateRoot

  • Change: AggregateRoot#apply can handle multiple events
  • Fix: #109 - AggregateRoot#apply returns applied events instead of all unpublished_events.

This is an important change as usually apply is the last method called inside your public methods and the resul is returned outside.

Developers can opt-out from this behavior by using

def apply(*events)
  super
  nil
end

in a class.

or by explicitly returning nil or self from public methods.

  def supply(quantity)
    raise NotRegistered unless @store_id
    apply(ProductSupplied.new(data: {
      store_id: @store_id,
      sku: @sku,
      quantity: quantity,
    }))
    nil
  end

Other gems

  • no changes

v0.15.0

30 Aug 13:29
Compare
Choose a tag to compare

In this release we've slightly changed release versioning policy - all gems from now on will get the same version number. This also means that all gems will be released even if there were changes in only one of them.

RailsEventStore

  • no changes

RubyEventStore

  • no changes

RailsEventStoreActiveRecord

  • no changes

AggregateRoot

  • no changes