event_sourcery 0.18.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c7c7b7c9f5d07418f3e80f02c63d1dfbc397f3c
4
- data.tar.gz: eb76565e36cae2e0fbf37f1917d1066658a6dccf
3
+ metadata.gz: 19b0a0d9e68626a19ba4b628c0b0e835d5f400e0
4
+ data.tar.gz: 92b65ee0ca76d3044530c77e6a1c56fbb66cc03c
5
5
  SHA512:
6
- metadata.gz: 5004d3f6ad1f82519f9afe698ec2fcd7ccc57fae439fb6d5fc322f079022d47d6d2cdd73601cfe3f31ad93938d9d47be8966607cf5bb0801ca814164a4ca30ab
7
- data.tar.gz: fc2262344a767d9c0d5ee8b1bdde83feb15471ae7536f8565717087bb3322f3110c7b6d4ac5dd25000352a6db1350ab17e9d3895de6ef60e3c58ffc23f1990f7
6
+ metadata.gz: 73c8044348497a991169477fd1075bf94bba46c02c686c8f8723bebf4b39f7f902fa38c1e79205520ffc0ed132e2a7cb7033d969de396d435eb1d94fa94645e2
7
+ data.tar.gz: c0184c613e7d89f4dee8d573913b3ddeda0df8b64a0bc490370a3c7c46be2f92db0f8d62357443af3bc32a7d550f212167d845bced0a6dd7c0d3920bd0b5850b
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
+ ## [0.19.0] - 2018-06-06
9
+
10
+ ### Added
11
+
12
+ - Allow passing an `after_fork` lambda to `ESPRunner` that is called after each
13
+ `ESPProcess` is forked
14
+
8
15
  ## [0.18.0] - 2018-05-23
9
16
 
10
17
  - Allow specifying a subscription batch size
@@ -129,7 +136,10 @@ moving all Postgres related code into a separate gem.
129
136
  - EventSourcery no longer depends on Virtus.
130
137
  - `Command` and `CommandHandler` have been removed.
131
138
 
132
- [Unreleased]: https://github.com/envato/event_sourcery/compare/v0.16.0...HEAD
139
+ [Unreleased]: https://github.com/envato/event_sourcery/compare/v0.19.0...HEAD
140
+ [0.19.0]: https://github.com/envato/event_sourcery/compare/v0.18.0...v0.19.0
141
+ [0.18.0]: https://github.com/envato/event_sourcery/compare/v0.17.0...v0.18.0
142
+ [0.17.0]: https://github.com/envato/event_sourcery/compare/v0.16.0...v0.17.0
133
143
  [0.16.0]: https://github.com/envato/event_sourcery/compare/v0.15.0...v0.16.0
134
144
  [0.15.0]: https://github.com/envato/event_sourcery/compare/v0.14.0...v0.15.0
135
145
  [0.14.0]: https://github.com/envato/event_sourcery/compare/v0.13.0...v0.14.0
@@ -1,18 +1,23 @@
1
1
  module EventSourcery
2
2
  module EventProcessing
3
3
  class ESPProcess
4
+ DEFAULT_AFTER_FORK = -> (event_processor) { }
5
+
4
6
  def initialize(event_processor:,
5
7
  event_source:,
6
- subscription_master: EventStore::SignalHandlingSubscriptionMaster.new)
8
+ subscription_master: EventStore::SignalHandlingSubscriptionMaster.new,
9
+ after_fork:)
7
10
  @event_processor = event_processor
8
11
  @event_source = event_source
9
12
  @subscription_master = subscription_master
13
+ @after_fork = after_fork || DEFAULT_AFTER_FORK
10
14
  end
11
-
15
+
12
16
  # This will start the Event Stream Processor which will subscribe
13
17
  # to the event stream source.
14
18
  def start
15
19
  name_process
20
+ @after_fork.call(@event_processor)
16
21
  error_handler.with_error_handling do
17
22
  EventSourcery.logger.info("Starting #{processor_name}")
18
23
  subscribe_to_event_stream
@@ -6,13 +6,15 @@ module EventSourcery
6
6
  def initialize(event_processors:,
7
7
  event_source:,
8
8
  max_seconds_for_processes_to_terminate: 30,
9
- shutdown_requested: false)
9
+ shutdown_requested: false,
10
+ after_fork: nil)
10
11
  @event_processors = event_processors
11
12
  @event_source = event_source
12
13
  @pids = []
13
14
  @max_seconds_for_processes_to_terminate = max_seconds_for_processes_to_terminate
14
15
  @shutdown_requested = shutdown_requested
15
16
  @exit_status = true
17
+ @after_fork = after_fork
16
18
  end
17
19
 
18
20
  # Start each Event Stream Processor in a new child process.
@@ -47,7 +49,8 @@ module EventSourcery
47
49
  def start_process(event_processor)
48
50
  process = ESPProcess.new(
49
51
  event_processor: event_processor,
50
- event_source: @event_source
52
+ event_source: @event_source,
53
+ after_fork: @after_fork,
51
54
  )
52
55
  @pids << Process.fork { process.start }
53
56
  end
@@ -1,4 +1,4 @@
1
1
  module EventSourcery
2
2
  # Defines the version
3
- VERSION = '0.18.0'.freeze
3
+ VERSION = '0.19.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_sourcery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Envato
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-23 00:00:00.000000000 Z
11
+ date: 2018-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler