rails_event_store 2.18.0 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8d1dd8069083e6f991e68d25687376ac88dd31a485745549f01bb70d4a54d7bf
|
|
4
|
+
data.tar.gz: 503dd9cf647d36364b9a82b3cb02c6d021bc115bdd2c5b769256a62e04f38cc8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a14dfbf271af51ea2138e8215ceed48245eb9f89c63a5835a1bf493634700e123bf2af03522798d92855ef271fe5572bb5869799935e6170b87cbab13846cd0
|
|
7
|
+
data.tar.gz: 54eeecbf0c5976b48dfc72d75e55b979cdf1056a00d0a801519422fd515e6bd7118b9b0b435de2c4f2bd7d0cf4fe87934b240c505de26db7ec8d389d1abccc19
|
|
@@ -1,52 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module RailsEventStore
|
|
4
|
-
class AfterCommitAsyncDispatcher
|
|
4
|
+
class AfterCommitAsyncDispatcher < AfterCommitDispatcher
|
|
5
5
|
def initialize(scheduler:)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def run(&schedule_proc)
|
|
14
|
-
transaction = ActiveRecord::Base.connection.current_transaction
|
|
15
|
-
|
|
16
|
-
if transaction.joinable?
|
|
17
|
-
transaction.add_record(async_record(schedule_proc))
|
|
18
|
-
else
|
|
19
|
-
yield
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def async_record(schedule_proc)
|
|
24
|
-
AsyncRecord.new(schedule_proc)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def verify(subscriber)
|
|
28
|
-
@scheduler.verify(subscriber)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
class AsyncRecord
|
|
32
|
-
def initialize(schedule_proc)
|
|
33
|
-
@schedule_proc = schedule_proc
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def committed!(*)
|
|
37
|
-
schedule_proc.call
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def rolledback!(*)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def before_committed!
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def trigger_transactional_callbacks?
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
attr_reader :schedule_proc
|
|
6
|
+
warn <<~EOW
|
|
7
|
+
DEPRECATION WARNING: `RailsEventStore::AfterCommitAsyncDispatcher` is deprecated and will be removed in the next major release.
|
|
8
|
+
Use `RailsEventStore::AfterCommitDispatcher` instead.
|
|
9
|
+
EOW
|
|
10
|
+
super
|
|
50
11
|
end
|
|
51
12
|
end
|
|
52
13
|
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RailsEventStore
|
|
4
|
+
class AfterCommitDispatcher
|
|
5
|
+
def initialize(scheduler:)
|
|
6
|
+
@scheduler = scheduler
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def call(subscriber, _, record)
|
|
10
|
+
run { @scheduler.call(subscriber, record) }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def run(&schedule_proc)
|
|
14
|
+
transaction = ActiveRecord::Base.connection.current_transaction
|
|
15
|
+
|
|
16
|
+
if transaction.joinable?
|
|
17
|
+
transaction.add_record(async_record(schedule_proc))
|
|
18
|
+
else
|
|
19
|
+
yield
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def async_record(schedule_proc)
|
|
24
|
+
AsyncRecord.new(schedule_proc)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def verify(subscriber)
|
|
28
|
+
@scheduler.verify(subscriber)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class AsyncRecord
|
|
32
|
+
def initialize(schedule_proc)
|
|
33
|
+
@schedule_proc = schedule_proc
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def committed!(*)
|
|
37
|
+
schedule_proc.call
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def rolledback!(*)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def before_committed!
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def trigger_transactional_callbacks?
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
attr_reader :schedule_proc
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require "ruby_event_store"
|
|
4
4
|
require_relative "async_handler_helpers"
|
|
5
5
|
require_relative "link_by_metadata"
|
|
6
|
+
require_relative "after_commit_dispatcher"
|
|
6
7
|
require_relative "after_commit_async_dispatcher"
|
|
7
8
|
require_relative "active_job_scheduler"
|
|
8
9
|
require_relative "active_job_id_only_scheduler"
|
|
@@ -13,21 +14,36 @@ require_relative "railtie"
|
|
|
13
14
|
require_relative "browser"
|
|
14
15
|
|
|
15
16
|
module RailsEventStore
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
DEPRECATED_CONSTANTS = {
|
|
18
|
+
Event: RubyEventStore::Event,
|
|
19
|
+
InMemoryRepository: RubyEventStore::InMemoryRepository,
|
|
20
|
+
Subscriptions: RubyEventStore::Subscriptions,
|
|
21
|
+
Projection: RubyEventStore::Projection,
|
|
22
|
+
WrongExpectedEventVersion: RubyEventStore::WrongExpectedEventVersion,
|
|
23
|
+
InvalidExpectedVersion: RubyEventStore::InvalidExpectedVersion,
|
|
24
|
+
IncorrectStreamData: RubyEventStore::IncorrectStreamData,
|
|
25
|
+
EventNotFound: RubyEventStore::EventNotFound,
|
|
26
|
+
SubscriberNotExist: RubyEventStore::SubscriberNotExist,
|
|
27
|
+
InvalidHandler: RubyEventStore::InvalidHandler,
|
|
28
|
+
InvalidPageStart: RubyEventStore::InvalidPageStart,
|
|
29
|
+
InvalidPageStop: RubyEventStore::InvalidPageStop,
|
|
30
|
+
InvalidPageSize: RubyEventStore::InvalidPageSize,
|
|
31
|
+
CorrelatedCommands: RubyEventStore::CorrelatedCommands,
|
|
32
|
+
GLOBAL_STREAM: RubyEventStore::GLOBAL_STREAM,
|
|
33
|
+
PAGE_SIZE: RubyEventStore::PAGE_SIZE,
|
|
34
|
+
ImmediateAsyncDispatcher: RubyEventStore::ImmediateAsyncDispatcher,
|
|
35
|
+
}.freeze
|
|
36
|
+
|
|
37
|
+
def self.const_missing(name)
|
|
38
|
+
if DEPRECATED_CONSTANTS.key?(name)
|
|
39
|
+
warn <<~EOW
|
|
40
|
+
RailsEventStore::#{name} is deprecated and will be removed in the next major release.
|
|
41
|
+
|
|
42
|
+
Use RubyEventStore::#{name} instead.
|
|
43
|
+
EOW
|
|
44
|
+
DEPRECATED_CONSTANTS.fetch(name)
|
|
45
|
+
else
|
|
46
|
+
super
|
|
47
|
+
end
|
|
48
|
+
end
|
|
33
49
|
end
|
|
@@ -41,10 +41,10 @@ module RailsEventStore
|
|
|
41
41
|
RubyEventStore::InstrumentedDispatcher.new(
|
|
42
42
|
dispatcher ||
|
|
43
43
|
RubyEventStore::ComposedDispatcher.new(
|
|
44
|
-
RailsEventStore::
|
|
44
|
+
RailsEventStore::AfterCommitDispatcher.new(
|
|
45
45
|
scheduler: ActiveJobScheduler.new(serializer: RubyEventStore::Serializers::YAML),
|
|
46
46
|
),
|
|
47
|
-
RubyEventStore::
|
|
47
|
+
RubyEventStore::SyncScheduler.new,
|
|
48
48
|
),
|
|
49
49
|
ActiveSupport::Notifications,
|
|
50
50
|
),
|
|
@@ -64,10 +64,10 @@ module RailsEventStore
|
|
|
64
64
|
message_broker: RubyEventStore::Broker.new(
|
|
65
65
|
subscriptions: RubyEventStore::Subscriptions.new,
|
|
66
66
|
dispatcher: RubyEventStore::ComposedDispatcher.new(
|
|
67
|
-
RailsEventStore::
|
|
67
|
+
RailsEventStore::AfterCommitDispatcher.new(
|
|
68
68
|
scheduler: RailsEventStore::ActiveJobScheduler.new(serializer: RubyEventStore::Serializers::YAML)
|
|
69
69
|
),
|
|
70
|
-
RubyEventStore::
|
|
70
|
+
RubyEventStore::SyncScheduler.new
|
|
71
71
|
)
|
|
72
72
|
)
|
|
73
73
|
)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_event_store
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.19.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Arkency
|
|
@@ -15,56 +15,56 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 2.
|
|
18
|
+
version: 2.19.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 2.
|
|
25
|
+
version: 2.19.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: ruby_event_store-browser
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - '='
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 2.
|
|
32
|
+
version: 2.19.0
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - '='
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 2.
|
|
39
|
+
version: 2.19.0
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: rails_event_store_active_record
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - '='
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 2.
|
|
46
|
+
version: 2.19.0
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - '='
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 2.
|
|
53
|
+
version: 2.19.0
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: aggregate_root
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - '='
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 2.
|
|
60
|
+
version: 2.19.0
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - '='
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 2.
|
|
67
|
+
version: 2.19.0
|
|
68
68
|
- !ruby/object:Gem::Dependency
|
|
69
69
|
name: activesupport
|
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -145,6 +145,7 @@ files:
|
|
|
145
145
|
- lib/rails_event_store/active_job_id_only_scheduler.rb
|
|
146
146
|
- lib/rails_event_store/active_job_scheduler.rb
|
|
147
147
|
- lib/rails_event_store/after_commit_async_dispatcher.rb
|
|
148
|
+
- lib/rails_event_store/after_commit_dispatcher.rb
|
|
148
149
|
- lib/rails_event_store/all.rb
|
|
149
150
|
- lib/rails_event_store/async_handler_helpers.rb
|
|
150
151
|
- lib/rails_event_store/browser.rb
|
|
@@ -177,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
177
178
|
- !ruby/object:Gem::Version
|
|
178
179
|
version: '0'
|
|
179
180
|
requirements: []
|
|
180
|
-
rubygems_version:
|
|
181
|
+
rubygems_version: 4.0.6
|
|
181
182
|
specification_version: 4
|
|
182
183
|
summary: Rails wrapper for RubyEventStore with batteries included
|
|
183
184
|
test_files: []
|