Skip to content

Releases: RailsEventStore/rails_event_store

v0.38.1

12 Mar 21:54
Compare
Choose a tag to compare

RailsEventStore

  • no changes

RubyEventStore

  • Fix: RubyEventStore::Mappers::EncryptionKey#decrypt forces UTF-8 encoding on decrypted message [ec23b10]

RailsEventStoreActiveRecord

  • no changes

AggregateRoot

  • no changes

RailsEventStore::RSpec

  • no changes

BoundedContext

  • no changes

RubyEventStore::Browser

  • no changes

RubyEventStore::ROM

  • no changes

v0.38.0

08 Mar 15:44
Compare
Choose a tag to compare

RailsEventStore

  • no changes

RubyEventStore

  • Add: Introducing RubyEventStore::Mappers::EncryptionMapper to allow partial encryption of event data attributes [#451, #361]

    More in GDPR documentation.

RailsEventStoreActiveRecord

  • no changes

AggregateRoot

  • no changes

RailsEventStore::RSpec

  • no changes

BoundedContext

  • no changes

RubyEventStore::Browser

  • no changes

RubyEventStore::ROM

  • no changes

v0.37.0

05 Mar 18:14
8ee8731
Compare
Choose a tag to compare

RailsEventStore

  • Remove: Deprecated RailsEventStore::Client#read_event is no more

  • Add: Convenience Enumerable#map and Enumerable#reduce on read API [#538]

    Was:

    event_store.read.stream(stream_name).each.reduce {|_, ev| apply(ev) }

    Becomes:

    event_store.read.stream(stream_name).reduce {|_, ev| apply(ev) }

RubyEventStore

  • Remove: Deprecated RubyEventStore::Client#read_event, RubyEventStore::SpecificationResult#count, RubyEventStore::SpecificationResult#direction, RubyEventStore::SpecificationResult#stream_name and RubyEventStore::SpecificationResult#global_stream? are no more [#534]

  • Remove: Migrator script from deprecated read API removed [#534]

  • Add: Convenience Enumerable#map and Enumerable#reduce on read API [#538]

    Was:

    event_store.read.stream(stream_name).each.reduce {|_, ev| apply(ev) }

    Becomes:

    event_store.read.stream(stream_name).reduce {|_, ev| apply(ev) }
  • Add: RubyEventStore::Mappers::InstrumentedMapper to allow instrumenting serialization and deserialization [#540]

    Usage with ActiveSupport::Notifications:

    RubyEventStore::Client.new(
      mapper: RubyEventStore::Mappers::InstrumentedMapper.new(
        mapper, 
        ActiveSupport::Notifications
      )
    )
    
    
    ActiveSupport::Notifications.subscribe("serialize.mapper.rails_event_store") do 
       ...
    end
    
    ActiveSupport::Notifications.subscribe("deserialize.mapper.rails_event_store") do 
       ...
    end
  • Change: RubyEventStore::Specification#of_type accepts now also a single event type in addition to an array of event types [#542]

  • Add: Introduce RubyEventStore::Specification#to in order to specify stop point for the read operation [#528, #529]

  • Add: Minimal linter (in form of shared RSpec tests) to verify event interface. Useful when you intend to implement your own Event class [#550, #553]

RailsEventStoreActiveRecord

  • no changes

AggregateRoot

  • Change: Restore AggregateRoot::Repository and shift persistence responsibility back to it from aggregate. Deprecates load and store methods on AggregateRoot module [#547]

RailsEventStore::RSpec

  • no changes

BoundedContext

  • no changes

RubyEventStore::Browser

  • Change: Migrate to Elm 0.19, no change in functionality [#548]

RubyEventStore::ROM

  • no changes

v0.36.0

22 Jan 01:16
Compare
Choose a tag to compare

RailsEventStore

  • Remove: Deprecated RailsEventStore::ActiveJobDispatcher, RailsEventStore::ActiveJobDispatcher::ActiveJobScheduler and RailsEventStore::AsyncProxyStrategy::AfterCommit are no more [#518]

  • Fix: Ensure dispatch for after commit strategy works in case of raise in after_commit callback [#519, #183]

  • Fix: Ensure RailsEventStore::AsyncHandler covers use case of background job systems integrated without ActiveJob interface [#507, 7d249f5]

RubyEventStore

  • Remove: Deprecated RubyEventStore:: AsyncDispatcher and RubyEventStore::AsyncProxyStrategy::Inline are no more [#518]

RailsEventStoreActiveRecord

  • no changes

AggregateRoot

  • no changes

RailsEventStore::RSpec

  • no changes

BoundedContext

  • no changes

RubyEventStore::Browser

  • no changes

RubyEventStore::ROM

  • Add: JSON support in migrations to allow specifying JSON or JSONB for data and metadata columns [#524]

  • Add: Upsert capability for updating events [#476]

RailsEventStoreActiveRecord::Legacy

No longer released from now on (deprecated in release 0.18.0).

v0.35.0

07 Dec 18:49
Compare
Choose a tag to compare

RailsEventStore

  • Add: APP_TEMPLATE to bootstrap Rails applications with rails_event_store gem.

    Usage:

    rails new -m https://raw.githubusercontent.com/RailsEventStore/rails_event_store/master/APP_TEMPLATE my_rails_app
    

RubyEventStore

  • Add: Support for Hash and Array as allowed types in RubyEventStore::Metadata [#501]

  • Add: Debugging API to get size of a stream to read [#503]

    client.read.stream('GoldCustomers').of_type([Customer::GoldStatusGranted]).count
    # => 42

RailsEventStoreActiveRecord

  • Change: Default column type for event data and metadata is now binary. This allows wider range of exchangeable components (i.e. encryption mapper). In general it is more suitable type to store anything [#490, #308]

    As it always is with data schema changes, a migration is required for existing data. Running migration:

    rails g rails_event_store_active_record:binary_data_and_metadata
    rails db:migrate
    

    Feel free to inspect and change generated migration. Make sure to check if your RDBMS can run this migration online and whether that meets your operational requirements.
    https://dev.mysql.com/doc/refman/5.7/en/innodb-online-ddl-operations.html#online-ddl-column-operations

    You can defer this migration for some time if you don't plan to use Protobuf at the moment. The future code in Rails Event Store and its extensions will however assume the columns are binary from now on and can't guarantee full compatibility.

AggregateRoot

  • Change: Make aggregate_root depend on ruby_event_store [4926dc4]

    Initially, when introducing this gem the event store API was simpler and we had plans to swap with with http_event_store. This has changed over the years and now aggregate_root is released along other RES gems.

RailsEventStore::RSpec

  • no changes

BoundedContext

  • no changes

RubyEventStore::Browser

  • no changes

RubyEventStore::ROM

  • no changes

RailsEventStoreActiveRecord::Legacy

  • no changes

v0.34.0

23 Nov 15:23
Compare
Choose a tag to compare

RailsEventStore

  • Add: New read API to filter read events by type event_store.read.of_type [#472]

     event_store = RailsEventStore::Client.new
     TweetPosted = Class.new(RubyEventStore::Event)
     TweetRetweeted = Class.new(RubyEventStore::Event)
     TweetLiked = Class.new(RubyEventStore::Event)
     event_store.publish(TweetPosted.new(event_id: '54994b0e-4fe3-4d58-8ffe-16755fcbc635', data: { message: 'Hello from @RailsEventStore!' }))
     event_store.publish(TweetRetweeted.new(event_id: '3d67e05d-04c6-4771-bdcc-d22d385390cb', data: { ... }))
    
    
     event_store.read.of_type([TweetPosted]).to_a
     # => [#<TweetPosted:0x00007fce3cab1a00 @event_id="54994b0e-4fe3-4d58-8ffe-16755fcbc635", @metadata=#<RubyEventStore::Metadata:0x00007fce3cab19b0 @h={:timestamp=>2018-10-12 17:50:27 UTC}>, @data={:message=>"Hello from @RailsEventStore!"}>]
    
     event_store.read.of_type([TweetLiked]).to_a
     # => []
  • Change: RailsEventStore::Event#initialize no longer calls to_h on data: argument. Default value for this argument stays effectively the same (which is {}). One now has an option to pass struct or any other object as data, provided your configured mapper knows how to handle it for serialization [#395, #480]

  • Add: Bring back RailsEventStore::Browser. This time not as a separate gem, rather a thin wrapper over RubyEventStore::Browser. It is no longer needed with rails_event_store to add browser as an explicit dependency. As a bonus RailsEventStore::Browser already has event_store_locator: pre-configured to typical Rails.configuration.event_store [#497]

    The whole process of mounting Browser in Rails is as simple as following:

    Rails.application.routes.draw do
      mount RailsEventStore::Browser => '/res' if Rails.env.development?
    end

RubyEventStore

  • Add: New read API to filter read events by type event_store.read.of_type [#472]

     event_store = RailsEventStore::Client.new
     TweetPosted = Class.new(RubyEventStore::Event)
     TweetRetweeted = Class.new(RubyEventStore::Event)
     TweetLiked = Class.new(RubyEventStore::Event)
     event_store.publish(TweetPosted.new(event_id: '54994b0e-4fe3-4d58-8ffe-16755fcbc635', data: { message: 'Hello from @RailsEventStore!' }))
     event_store.publish(TweetRetweeted.new(event_id: '3d67e05d-04c6-4771-bdcc-d22d385390cb', data: { ... }))
    
    
     event_store.read.of_type([TweetPosted]).to_a
     # => [#<TweetPosted:0x00007fce3cab1a00 @event_id="54994b0e-4fe3-4d58-8ffe-16755fcbc635", @metadata=#<RubyEventStore::Metadata:0x00007fce3cab19b0 @h={:timestamp=>2018-10-12 17:50:27 UTC}>, @data={:message=>"Hello from @RailsEventStore!"}>]
    
     event_store.read.of_type([TweetLiked]).to_a
     # => []
  • Fix: Do not compare object instances of event id while looking for streams of event [#492]

  • Fix: read.events([]) returning whole dataset of stored events [#498]

  • Change: RubyEventStore::Event#initialize no longer calls to_h on data: argument. Default value for this argument stays effectively the same (which is {}). One now has an option to pass struct or any other object as data, provided your configured mapper knows how to handle it for serialization [#395, #480]

  • Add: Explicit RubyEventStore::ProtobufEncodingFailed raised when event's data is not serializable by RubyEventStore::Mappers::Protobuf [#481]

  • Fix: RubyEventStore::Mappers::Default#serialized_record_to_event now symbolizes metadata keys. This helps when your serializer cannot distinguish symbols from strings (i.e. when you choose JSON as a serializer) [#367, #489]

    When using RubyEventStore::Mappers::Default.new(serializer: JSON) it is advisable to make following or similar adjustment to your base Event class. That way you'll shield yourself from JSON turning symbols intro strings:

    class MyEvent < RailsEventStore::Event
      def data
        ActiveSupport::HashWithIndifferentAccess.new(super)
      end
    end
    
    OrderPlaced = Class.new(MyEvent)

    More on configuring a different serializer section.

RailsEventStoreActiveRecord

  • Add: Support for filtering by event type [#472]

  • Add: New migration generator to add an index on event_type attribute. Strongly recommended to apply if you plan to use filtering by event types — otherwise performance when using event_store.read.of_type(...) might be degraded. Added in default schema creation generator for new deployments. [#472]

    Running migration:

    rails g rails_event_store_active_record:index_by_event_type
    rails db:migrate
    

    Feel free to inspect and change generated migration. Make sure to check if your RDBMS can run this migration online and whether that meets your operational requirements.
    https://dev.mysql.com/doc/refman/5.7/en/innodb-online-ddl-operations.html#online-ddl-index-operations

  • Add: New migration generator to add a limit on event_id attribute in event_store_events_in_streams table. Applicable for MySQL and Sqlite databases. This migration is skipped on PostgreSQL. Feel free to skip this migration if it's too problematic to apply on existing data. Added in default schema creation generator for new deployments. [#479]

    Running migration:

    rails g rails_event_store_active_record:limit_for_event_id
    rails db:migrate
    

    Feel free to inspect and change generated migration. Make sure to check if your RDBMS can run this migration online and whether that meets your operational requirements.
    https://dev.mysql.com/doc/refman/5.7/en/innodb-online-ddl-operations.html#online-ddl-column-operations

  • Add: to_a implementation for read specification. Allows to avoid commonly used event_store.read.each.to_a by just using event_store.read.to_a. Also added to_a & first methods to BatchEnumerator. Closes #496. [#499]

AggregateRoot

  • no changes

RailsEventStore::RSpec

  • no changes

BoundedContext

  • no changes

RubyEventStore::Browser

  • Fix: Ensure Browser works with non-default metadata serialization [#491]

  • Change: Provide default arguments to RubyEventStore::Browser::App.for for less required setup in typical use case [#483]

    Now only event_store_locator: is required when mounting Browser inside existing app.

    require 'ruby_event_store/browser/app'
    
    Rails.application.routes.draw do
      mount RubyEventStore::Browser::App.for(
        event_store_locator: -> { Rails.configuration.event_store },
      ) => '/res' if Rails.env.development?
    end

RubyEventStore::ROM

  • Support for filtering by event type [#472]

RailsEventStoreActiveRecord::Legacy

  • Support for filtering by event type [#472]

v0.33.0

12 Oct 18:39
Compare
Choose a tag to compare

RailsEventStore

  • Remove: Deprecated RailsEventStore::Client#publish_event, RailsEventStore::Client#publish_events, RailsEventStore::Client#link_to_stream and RailsEventStore::Client#append_to_stream are no more.

  • Change: Less chatty RailsEventStore::Client instance in console [#465]

    Please use RailsEventStore::Client#publish, RailsEventStore::Client#link and RailsEventStore::Client#append instead.

  • Change: Unify read API further more by introducing event_store.read.event, event_store.read.event! and event_store.read.events. Deprecates event_store.read_event [#462]

     event_store = RailsEventStore::Client.new
     TweetPosted = Class.new(RubyEventStore::Event)
     event_store.publish(TweetPosted.new(event_id: '54994b0e-4fe3-4d58-8ffe-16755fcbc635', data: { message: 'Hello from @RailsEventStore!' }))
    
     event_store.read.event('54994b0e-4fe3-4d58-8ffe-16755fcbc635')
     # => #<TweetPosted:0x00007fce3cb166d0 @event_id="54994b0e-4fe3-4d58-8ffe-16755fcbc635", @metadata=#<RubyEventStore::Metadata:0x00007fce3cb16658 @h={:timestamp=>2018-10-12 17:50:27 UTC}>, @data={:message=>"Hello from @RailsEventStore!"}>
     event_store.read.event('54994b0e-4fe3-4d58-8ffe-xxxxx')
     # => nil
    
     event_store.read.event!('54994b0e-4fe3-4d58-8ffe-16755fcbc635')
     # => #<TweetPosted:0x00007fce3cb05498 @event_id="54994b0e-4fe3-4d58-8ffe-16755fcbc635", @metadata=#<RubyEventStore::Metadata:0x00007fce3cb05448 @h={:timestamp=>2018-10-12 17:50:27 UTC}>, @data={:message=>"Hello from @RailsEventStore!"}>
     event_store.read.event!('54994b0e-4fe3-4d58-8ffe-xxxxx')
     # => RailsEventStore::EventNotFound (Event not found: 54994b0e-4fe3-4d58-8ffe-xxxxx)
    
     event_store.read.events(['54994b0e-4fe3-4d58-8ffe-xxxxx', '54994b0e-4fe3-4d58-8ffe-16755fcbc635']).to_a
     # => [#<TweetPosted:0x00007fce3cab1a00 @event_id="54994b0e-4fe3-4d58-8ffe-16755fcbc635", @metadata=#<RubyEventStore::Metadata:0x00007fce3cab19b0 @h={:timestamp=>2018-10-12 17:50:27 UTC}>, @data={:message=>"Hello from @RailsEventStore!"}>]

RubyEventStore

  • Remove: Deprecated RubyEventStore::Client#publish_event, RubyEventStore::Client#publish_events, RubyEventStore::Client#link_to_stream and RubyEventStore::Client#append_to_stream are no more.

    Please use RubyEventStore::Client#publish, RubyEventStore::Client#link and RubyEventStore::Client#append instead.

  • Change: Less chatty RubyEventStore::Client instance in console [#465]

  • Change: Unify read API further more by introducing event_store.read.event, event_store.read.event! and event_store.read.events. Deprecates event_store.read_event [#462]

     event_store = RubyEventStore::Client.new(repository: RubyEventStore::InMemoryRepository.new)
     TweetPosted = Class.new(RubyEventStore::Event)
     event_store.publish(TweetPosted.new(event_id: '54994b0e-4fe3-4d58-8ffe-16755fcbc635', data: { message: 'Hello from @RailsEventStore!' }))
    
     event_store.read.event('54994b0e-4fe3-4d58-8ffe-16755fcbc635')
     # => #<TweetPosted:0x00007fce3cb166d0 @event_id="54994b0e-4fe3-4d58-8ffe-16755fcbc635", @metadata=#<RubyEventStore::Metadata:0x00007fce3cb16658 @h={:timestamp=>2018-10-12 17:50:27 UTC}>, @data={:message=>"Hello from @RailsEventStore!"}>
     event_store.read.event('54994b0e-4fe3-4d58-8ffe-xxxxx')
     # => nil
    
     event_store.read.event!('54994b0e-4fe3-4d58-8ffe-16755fcbc635')
     # => #<TweetPosted:0x00007fce3cb05498 @event_id="54994b0e-4fe3-4d58-8ffe-16755fcbc635", @metadata=#<RubyEventStore::Metadata:0x00007fce3cb05448 @h={:timestamp=>2018-10-12 17:50:27 UTC}>, @data={:message=>"Hello from @RailsEventStore!"}>
     event_store.read.event!('54994b0e-4fe3-4d58-8ffe-xxxxx')
     # => RubyEventStore::EventNotFound (Event not found: 54994b0e-4fe3-4d58-8ffe-xxxxx)
    
     event_store.read.events(['54994b0e-4fe3-4d58-8ffe-xxxxx', '54994b0e-4fe3-4d58-8ffe-16755fcbc635']).to_a
     # => [#<TweetPosted:0x00007fce3cab1a00 @event_id="54994b0e-4fe3-4d58-8ffe-16755fcbc635", @metadata=#<RubyEventStore::Metadata:0x00007fce3cab19b0 @h={:timestamp=>2018-10-12 17:50:27 UTC}>, @data={:message=>"Hello from @RailsEventStore!"}>]

RailsEventStoreActiveRecord

  • Fix: Make sure legacy schema presence is not checked when event_store_events table is not created yet. Improves situation when initializing RailsEventStore::EventRepository would prevent a migration to create such table to execute [#464]

AggregateRoot

  • no changes

RailsEventStore::RSpec

  • no changes

BoundedContext

  • no changes

RubyEventStore::Browser

  • no changes

Just a reminder that RailsEventStore::Browser is discontinued. RubyEventStore::Browser can do the same and works in and outside of Rails. Read more on enabling browser in docs

RubyEventStore::ROM

  • no changes

RailsEventStoreActiveRecord::Legacy

  • no changes

v0.32.0

27 Sep 09:23
Compare
Choose a tag to compare

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]

v0.31.1

17 Jul 21:48
Compare
Choose a tag to compare

RailsEventStore

  • Fix: Don't use deprecated link_to_stream in RailsEventStore::LinkByMetadata, RailsEventStore::LinkByCorrelationId, RailsEventStore::LinkByCausationId [37df713]

RubyEventStore

  • Fix: Don't use deprecated link_to_stream in RubyEventStore::LinkByMetadata, RubyEventStore::LinkByCorrelationId, RubyEventStore::LinkByCausationId [37df713]

RailsEventStoreActiveRecord

  • no changes

AggregateRoot

  • no changes

RailsEventStore::RSpec

  • no changes

BoundedContext

  • no changes

RailsEventStore::Browser

  • no changes

RubyEventStore::ROM

  • no changes

RailsEventStoreActiveRecord::Legacy

  • no changes

v0.31.0

17 Jul 20:53
Compare
Choose a tag to compare

Warning

  • When upgrading from v0.30 to v0.31, make sure all events serialized when using the old version are already processed by all async handlers and new events are not generated.
  • Rolling deploy of a new version might cause issues due to slight changes on how events are serialized for async handlers.

RailsEventStore

  • Add: Correlation between events in synchronous event handlers. When you publish events, their metadata will be enriched with correlation_id and causation_id [#374]. You can read more about correlation and causation in our documentation.

  • Change: Subtle change in metadata assignment disallowing overwriting key, once it is present. [#374]

  • Change: Signature change of RailsEventStore::ActiveJobDispatcher#call from (subscriber, event) to (subscriber, event, serialized_event). Dispatcher receives now also a serialized event (serialization happens via configured mapper, by default that is still YAML) [#363]

  • Change: Signature change of RailsEventStore::AsyncProxyStrategy::Inline#call and RailsEventStore::AsyncProxyStrategy::AfterCommit#call from (klass, event) to (klass, serialized_event). Strategies no longer perform serialization on their own, eliminating duplication of effort and using chosen mapper. [#363]

  • Add: RubyEventStore::Client#deserialize(event_type:, event_id:, data:, metadata:) [#363]

    For existing asynchronous handlers you need to perform following change from:

    class SendOrderEmail < ActiveJob::Base
      def perform(payload)
        event = YAML.load(payload)
        email = event.data.fetch(:customer_email)
        OrderMailer.notify_customer(email).deliver_now!
      end
    end

    to:

    class SendOrderEmail < ActiveJob::Base
      def perform(payload)
        event = event_store.deserialize(payload)
        email = event.data.fetch(:customer_email)
        OrderMailer.notify_customer(email).deliver_now!
      end
    
      private
      def event_store
        Rails.configuration.event_store
      end
    end

    or you can use RailsEventStore::AsyncHandler

    class SendOrderEmail < ActiveJob::Base
      prepend RailsEventStore::AsyncHandler
    
      def perform(event)
        email = event.data.fetch(:customer_email)
        OrderMailer.notify_customer(email).deliver_now!
      end
    end
  • Add: Introduce RailsEventStore::LinkByMetadata, RailsEventStore::LinkByCorrelationId, RailsEventStore::LinkByCausationId, RailsEventStore::LinkByEventType. These event handlers allow to partition streams by particular quality. Streams formed by these handlers are made by linking events, therefore are cheap [#382, #346]

  • Change: Deprecate RailsEventStore::Client#publish_event and RailsEventStore::Client#publish_events. They're now just RailsEventStore::Client#publish [#366, #377]

  • Change: Deprecate RailsEventStore::Client#link_to_stream. This is now RailsEventStore::Client#link [#388]

  • Change: Deprecate RailsEventStore::Client#append_to_stream . This is now RailsEventStore::Client#append [#387]

  • Add: Introduce RailsEventStore::AsyncHandler and RailsEventStore::CorrelatedHandler to help with correlating events coming from async handlers [#379, #346]. You can read more about correlation and causation in our documentation.

  • Add: Introduce RailsEventStore::CorrelatedCommands to aid correlating commands going through command_bus with events [#375, #346]. You can read more about correlation and causation in our documentation.

  • Change: Breaking change of RailsEventStore::Client#initialize signature. Out is event_broker:, in subscriptions: and dispatcher:. Dispatcher is no longer an event broker dependency [#389, #265]

RubyEventStore

  • Remove: Deprecated RubyEventStore::Client#metadata_proc has been removed. Similar functionality available via RubyEventStore::Client#with_metadata [#373]

  • Add: Correlation between events in synchronous event handlers. When you publish events, their metadata will be enriched with correlation_id and causation_id [#374]

  • Change: Subtle change in metadata assignment disallowing overwriting key, once it is present. [#374]

  • Change: Signature change of RubyEventStore::PubSub::Dispatcher#call from (subscriber, event) to (subscriber, event, serialized_event). Dispatcher receives now also a serialized event (serialization happens via configured mapper, by default that is still YAML) [#363]

  • Change: Signature change of RubyEventStore:: PubSub::Broker#notify_subscribers from (event) to (event, serialized_event) [#346]

  • Add: RubyEventStore::Client#deserialize(event_type:, event_id:, data:, metadata:) [#346]

  • Add: Introduce RubyEventStore::LinkByMetadata, RubyEventStore::LinkByCorrelationId, RubyEventStore::LinkByCausationId, RubyEventStore::LinkByEventType. These event handlers allow to partition streams by particular quality. Streams formed by these handlers are made by linking events, therefore are cheap [#382, #346]

  • Change: Deprecate RubyEventStore::Client#publish_event and RubyEventStore::Client#publish_events. They're now just RubyEventStore::Client#publish [#366, #377]

  • Change: Deprecate RubyEventStore::Client#link_to_stream. This is now RubyEventStore::Client#link [#388]

  • Change: Deprecate RubyEventStore::Client#append_to_stream . This is now RubyEventStore::Client#append [#387]

  • Add: Introduce RubyEventStore::CorrelatedCommands to aid correlating commands going through command_bus with events [#375, #346]. You can read more about correlation and causation in our documentation.

  • Change: Breaking change of RubyEventStore::Client#initialize signature. Out is event_broker:, in subscriptions: and dispatcher:. Dispatcher is no longer an event broker dependency [#389, #265]

  • Add: Introduce RubyEventStore::AsyncDispatcher. Previously the only implementation of asynchronous dispatcher was present in form of RailsEventStore::ActiveJobDispatcher. This new class allows you to have all benefits of asynchronous dispatch while only requiring you to provide details of your background queue implementation [#381, #383]

    As an example this is howRailsEventStore::ActiveJobDispatcher can be implemented (and thus similar SidekiqDispatcher):

    require 'active_job'
    
    module RailsEventStore
    
      class ActiveJobDispatcher < AsyncDispatcher
        def initialize(proxy_strategy: AsyncProxyStrategy::Inline.new)
          super(proxy_strategy: proxy_strategy, scheduler: ActiveJobScheduler.new)
        end
    
        class ActiveJobScheduler
          def call(klass, serialized_event)
            klass.perform_later(serialized_event.to_h)
          end
    
          def async_handler?(klass)
            Class === klass && klass < ActiveJob::Base
          end
        end
      end
    end

RailsEventStoreActiveRecord

  • no changes

AggregateRoot

  • Change: Ensure publish does not incidentally receive an Enumerator (ade8f84)

RailsEventStore::RSpec

  • Add: publish matcher to verify expectation on given block of code. Disregards events published before expect { } block [#370]

    expect {
      MyService.new.call
    }.to publish(an_event(FooEvent)).in_stream("Foo$1234").in(event_store)

BoundedContext

  • no changes

RailsEventStore::Browser

  • no changes

RubyEventStore::ROM

  • Add: ROM Memory adapter implementation to allow easily adding alternate ROM implementations. This implements the ROM Memory adapter as an alternative to the ROM SQL adapter. Tests are structured to test ROM implementations easily. A new ROM adapter simply needs to implement the two relations required [#365]

RailsEventStoreActiveRecord::Legacy

  • no changes