Releases: RailsEventStore/rails_event_store
v2.10.0
RubyEventStore
- no changes
RailsEventStore
-
Add: Optional
ActiveJobIdOnlySchedulerthat carries onlyevent_id. The largest benefit of it has constant size in redis as opposed to size dependent on data and metadata. With the scheduler comes theAsyncHandlerJobIdOnly[#755, 46dedc2] -
Fix:
JSONClientcorrectly handles mapper argument. Previously the mapper argument was unusable, as it was always and unconditionally overwritten [77b7338]
RubyEventStore::ActiveRecord
-
Add: MySQL now supports json column data type for storing data and metadata of events [8e4850b, ]
-
Fix:
streams_ofbeing slow due to lack of index onevent_idinevent_store_events_in_streamstable (e.g. causing laggy event overview in RES Browser) [5c2c367]When installing RES from scratch, you don't have to do anything, RES setup will generate valid db migrations. If you're running RES in your existing application, please run accordingly:
-
for a Rails app:
bin/rails g rails_event_store_active_record:migration_for_missing_event_id_index bin/rails db:migrate -
for a non–Rails Ruby app:
bundle exec rake db:migrations:fix_missing_event_id_index bundle exec rake db:migrate
-
AggregateRoot
- no changes
RubyEventStore::RSpec
- no changes
RubyEventStore::Browser
- no changes
v2.9.1
RubyEventStore
- Fix: Encryption Mapper
The missing transformation has been added. TheRubyEventStore::Metadatarequires metadata keys to be symbols. - Change:
RubyEventStore::Clientnow has theInMemoryRepositoryas the default repository.
There's no required action. This change is backward compatible.
RailsEventStore
- no changes
RubyEventStore::ActiveRecord
- Fix: Problem with reading the last event sorted by
valid_at. - Change: Update
ActiveRecord::Migrationversion from 4.2 to the latest.
The schema doesn't change. There's no required action.
AggregateRoot
- no changes
RubyEventStore::RSpec
- no changes
RubyEventStore::Browser
- no changes
v2.9.0
RubyEventStore
- no changes
RailsEventStore
- Add: Enhanced Rails Event Store client for working with JSONB datatype.
RailsEventStore::JSONClient is built on top of RailsEventStore::Client and supports the same functionality. However, it's optimized to work with the JSONB data type and provides valid configuration for serializing and deserializing events.
To configure this in your project, use:
Rails.configuration.event_store = RailsEventStore::JSONClient.newYou can find more detailed information about configuration in the docs.
- Change: Improved APP_TEMPLATE, which can now be used both for new and existing Rails applications. The goal of this change is to minimize the number of steps required to install RailsEventStore.
The template:
- adds
rails_event_storeto yourGemfile - generates
config/initializers/rails_event_store.rbwith sane defaults and exposes the client underRails.configuration.event_store - pre–configure the event browser to make it available under
/resurl in your application in development environment - runs bundler to install necessary dependencies
- generates and executes migrations files
To use the template in an existing Rails application, cd to the root directory and run the following command
bin/rails app:template LOCATION=https://railseventstore.org/newIf you're starting a new Rails application, run the following command
rails new -m https://railseventstore.org/new APP_NAMERead more about options that can be specified during the setup, eg. a database that you want to use.
RailsEventStoreActiveRecord
- no changes
AggregateRoot
- no changes
RubyEventStore::RSpec
- no changes
RubyEventStore::Browser
- no changes
v2.8.1
v2.8.0
RubyEventStore
-
Add: Possibility to declare stored type for type serializers of
Mappers::Transformation::PreserveTypestransformation [832be46]Most of the time serializers in
Mappers::Transformation::PreserveTypescan rely onClass#nameto deduct the type. However in some edge cases this is not sufficient. For exampleActiveSupport::TimeWithZoneoverrides name to present itself asTime.PreserveTypes.new .register( ActiveSupport::TimeWithZone, serializer: -> (v) { v.iso8601(9) }, deserializer: -> (v) { Time.iso8601(v).in_time_zone }, stored_type: -> (v) { "ActiveSupport::TimeWithZone" } # don't rely on v.class.name for this type )
RailsEventStore
-
Add: Bounded context generator now generates test requires for minitest like it did for rspec [#1189, de4f742]
This helps
rails trunner and other tools to discover bounded context tests.
RailsEventStoreActiveRecord
-
Fix: Correct order when reading bi-temporal events by
valid_attimestamp, when it was the same ascreated_at[fa484a5, #1518]When
created_atandvalid_atare the same, we apply an optimization to store only the former timestamp. Reads ordered byvalid_at(as_of) did not adjust to this optimization correctly. -
Change: When reading events of particular named stream, don't join to
event_store_eventstable when filtering criteria do not require it [8caeb4e, #1517]This is expected to improve performance when reading enormous streams without filtering.
AggregateRoot
- no changes
RubyEventStore::RSpec
- no changes
RubyEventStore::Browser
- no changes
v2.7.0
RubyEventStore
- no changes
RailsEventStore
- no changes
RailsEventStoreActiveRecord
- Change: Add dependency on
ruby_event_store-active_recordgem. Despite additional dependency, everything else stays the same on the surface until next major version.
RubyEventStore::ActiveRecord
This is a new gem, that will be replacing rails_event_store_active_record in the next major version — that is 3.0. The rails_event_store_active_record already did not depend on Rails, but it has the name suggesting otherwise. This is what we're gradually changing.
What is more, the ruby_event_store-active_record ships with a convenient Rake task to generate and perform migrations without Rails. It also gives a possibility to perform database-related tasks provided by ActiveRecord [#1479]
Usage:
# Rakefile
require "ruby_event_store/active_record/rake_task"To generate a migration with event store tables, type:
bundle exec rake db:migrations:copy DATA_TYPE=data_type
By default, migrations are created at db/migrate directory.
Available data types are jsonb, json and binary for PostgreSQL. For MySQL and SQLite the data type can be only set to binary.
To perform the migration, type:
DATABASE_URL=your_database_url bundle exec rake db:migrate
AggregateRoot
-
Add: Introduced experimental
AggregateRoot::SnapshotRepository[#1480]repository = AggregateRoot::SnapshotRepository.new(event_store)
It uses an additional stream to store aggregate dumps in marshal format with a configurable interval.
# saves aggregate snapshot on each 50 events repository = AggregateRoot::SnapshotRepository.new(event_store, 50)
Marshal format has its limitations. Dumping an aggregate will not work if its instance variables are bindings, procedure or method objects, instances of class IO, or singleton objects. In such cases, a standard procedure of storing and loading aggregate from its whole events stream will be applied.
To control whether aggregate roots are dumped and restored properly, you can subscribe to
ActiveSupport::NotificationsviaAggregateRoot::InstrumentedRepository.require 'logger' instrumented_repository = InstrumentedRepository.new(repository, ActiveSupport::Notifications) logger = Logger.new(STDOUT) ActiveSupport::Notifications.subscribe("error_occured.repository.aggregate_root") do |_name, _start, _finish, _id, payload| logger.warn(payload[:exception_object].message) end
Related: https://blog.arkency.com/speed-up-aggregate-roots-loading-with-snapshot-events/
RubyEventStore::RSpec
- no changes
RubyEventStore::Browser
-
Fix: compatibility with
Pathnameobjects present in$LOAD_PATH[#1494, 8acc93c]Apparently Rails suggests extending
$LOAD_PATHwithPathname, e.g.config.autoload_paths << Rails.root.join("extras")inconfig/application.rb. Rubocop is also forcing those. We're only looking for bundler-added entries in$LOAD_PATHwhich are definitely strings.
v2.6.0
RubyEventStore
-
Change: Friendlier default.
RubyEventStore::InMemoryRepositoryis now the default repository forRubyEventStore::Client[#978] -
Add: Preserve types transform [#1103]
Adds a new transformation
RubyEventStore::Mappers::Transformation::PreserveTypes. Not used by default,
you need to explicitly define it in your pipeline mapper. It allows to register custom serializer and deserializer
for types used in domain event attributes. Information about types is stored in event's metadata.Usage:
class MyMapper < RubyEventStore::Mappers::PipelineMapper def initialize super( RubyEventStore::Mappers::Pipeline.new( Transformation::PreserveTypes .new .register(Symbol, serializer: ->(v) { v.to_s }, deserializer: ->(v) { v.to_sym }) .register(Time, serializer: ->(v) { v.iso8601(9) }, deserializer: ->(v) { Time.iso8601(v) }) .register(Date, serializer: ->(v) { v.iso8601 }, deserializer: ->(v) { Date.iso8601(v) }) .register(DateTime, serializer: ->(v) { v.iso8601(9) }, deserializer: ->(v) { DateTime.iso8601(v) }), Transformation::SymbolizeMetadataKeys.new ) ) end end
-
Add: Instrumented subscriptions [#1109]
RailsEventStore
-
Change: Instrumented subscriptions are now used by default to instrument subscriptions creation [#1109]
-
Change: Transform the job arguments with symbol keys to string keys when using
RailsEventStore::ActiveJobScheduler. This enables compatibility with Sidekiq 7 used as an engine in ActiveJob and clears warnings generated with Sidekiq < 7 [d602ac2]
RailsEventStoreActiveRecord
- Fix: Unexpected handling of empty array when linking using AR repo. Linking empty list to stream should be a no-op [#1430, #1417]
AggregateRoot
-
Add: Instrument AggregateRoot's apply method with instrumented apply strategy [#1111]
You need to explicitly wrap you apply strategy with
AggregateRoot::InstrumentedApplyStrategyto use it.
RubyEventStore::RSpec
- no changes
RubyEventStore::Browser
-
Change: Browser working from git source [#1187]
Previously you could not use Browser when using
ruby_event_store-browserfrom git source. Directly or indirectly, when pointingrails_event_storetogithub: RailsEventStore/rails_event_storeinGemfile. Now, for particular commits, that are head of pushed changeset, we're building source assets and pushing them to CDN. Browser is aware of being sourced from git repository and switches to CDN source for this particular commit that it is built from. It is quite limited but still an improvement. We're looking for reliable way to build assets for each commit pushed in a changeset, so that limitations are gone. -
Change: Rack 3.0 compatibility [956c3cd]
-
Fix: Browser now displays all streams that an event belongs to [comment]
v2.5.1
v2.5.0
RubyEventStore
- no changes
RailsEventStore
- no changes
RailsEventStoreActiveRecord
- no changes
AggregateRoot
- no changes
RubyEventStore::RSpec
- no changes
RubyEventStore::Browser
-
Fix: Support Content-Security-Policy for
style-src— no inline styles in Browser. [#1346] -
Change: Drop
sinatradependency. Now onlyrackis needed to run Browser — whether mounted in Rails, Hanami or as a standalone application. [#1341, #958] -
Deprecate: Passing keyword arguments
environment,hostorpathtoRubyEventStore::Browser::App.foris deprecated and scheduled for removal on next major release. These options no longer make sense and Browser can handle well existing use cases without them. [6e0b85e]
v2.4.1
RubyEventStore
- no changes
RailsEventStore
- no changes
RailsEventStoreActiveRecord
-
Fix: Regression when appending empty list of records [f741204]
Normally appending empty list of records should result in a no-operation. When introducing ActiveRecord's bulk insert functionality over external
activerecord-import, we unintentionally leaked its behaviour for empty collections:ArgumentError: Empty list of attributes passedThis release restores old behaviour and ensures it remains consistent across all shipped event repositories.
AggregateRoot
- no changes
RubyEventStore::RSpec
- no changes
RubyEventStore::Browser
- no changes