event_sourcery 0.17.0 → 0.18.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: d676408ca476e668d70f08dd1c29ce1c93f25415
4
- data.tar.gz: e34dfb803088dce3cff191f95b251af18470f659
3
+ metadata.gz: 9c7c7b7c9f5d07418f3e80f02c63d1dfbc397f3c
4
+ data.tar.gz: eb76565e36cae2e0fbf37f1917d1066658a6dccf
5
5
  SHA512:
6
- metadata.gz: 6b9fa74a6699e135575a52e5edfe4f0c9cd32c9ee1ee6cc74ae32ca1a543f6090044d2aebc63c8ed9ee35481aeff9f5990d1d4911cf4cf1d15b3923abedbec14
7
- data.tar.gz: e17b0c1cb636abfb81524d1197afe8bf4836f5ffdda50180bb1c7322c3a0e1ab66595d0e80ef1810b4d86496defe33c2edfe499367dec660939a4d74f13081f8
6
+ metadata.gz: 5004d3f6ad1f82519f9afe698ec2fcd7ccc57fae439fb6d5fc322f079022d47d6d2cdd73601cfe3f31ad93938d9d47be8966607cf5bb0801ca814164a4ca30ab
7
+ data.tar.gz: fc2262344a767d9c0d5ee8b1bdde83feb15471ae7536f8565717087bb3322f3110c7b6d4ac5dd25000352a6db1350ab17e9d3895de6ef60e3c58ffc23f1990f7
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ 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.18.0] - 2018-05-23
9
+
10
+ - Allow specifying a subscription batch size
11
+
8
12
  ## [0.17.0] - 2018-03-22
9
13
  ### Added
10
14
  - Allow changing the event class using Event#with
@@ -40,7 +44,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
40
44
  - Fixed typo in constant name `EventSourcery::EventProcessing::ErrorHandlers::ExponentialBackoffRetry::MAX_RETRY_INTERVAL`
41
45
  - Errors of type `Exception` are now logged before being allowed to propagate.
42
46
 
43
- ## [0.14.0] - 2016-6-21
47
+ ## [0.14.0] - 2016-06-21
44
48
  ### Added
45
49
  - Added `Event#to_h` method. This returns a hash of the event attributes.
46
50
  - Added `Event#with` method. This provides a way to create a new event
@@ -48,7 +52,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
48
52
  - `Event#initialize` accepts `aggregate_id` parameter that either is
49
53
  a strings or responds to `to_str`.
50
54
 
51
- ## [0.13.0] - 2016-6-16
55
+ ## [0.13.0] - 2016-06-16
52
56
  ### Added
53
57
  - The core Event class accepts `causation_id` to allow event stores to
54
58
  add support for tracking causation ids with events.
@@ -63,27 +67,27 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
63
67
  be a mechanism to wrap processing and tracker updates which appears to be
64
68
  universally unused at this point.
65
69
 
66
- ## [0.12.0] - 2017-6-1
70
+ ## [0.12.0] - 2017-06-01
67
71
  ### Removed
68
72
  - Removed usage `#shutdown!` as it should be a private method within custom PollWaiters.
69
73
  An example of how event_sourcery-postgres has implemented `#shutdown!` can be
70
74
  found [here](https://github.com/envato/event_sourcery-postgres/pull/5)
71
75
 
72
- ## [0.11.2] - 2017-5-29
76
+ ## [0.11.2] - 2017-05-29
73
77
  ### Fixed
74
78
  - Fixed: default poll waiter now implements `shutdown!`
75
79
 
76
- ## [0.11.1] - 2017-5-29
80
+ ## [0.11.1] - 2017-05-29
77
81
  ### Fixed
78
82
  - Use `processor.class.name` to set ESP process name
79
83
  - Convert `processor_name` symbol to string explicitly
80
84
 
81
- ## [0.11.0] - 2017-5-26
85
+ ## [0.11.0] - 2017-05-26
82
86
  ### Added
83
87
  - Make Event processing error handler class Configurable
84
88
  - Add exponential back off retry error handler
85
89
 
86
- ## [0.10.0] - 2017-5-24
90
+ ## [0.10.0] - 2017-05-24
87
91
  ### Added
88
92
  - The core Event class accepts `correlation_id` to allow event stores to
89
93
  add support for tracking correlation IDs with events.
@@ -29,6 +29,9 @@ module EventSourcery
29
29
  :event_body_serializer,
30
30
  :event_builder
31
31
 
32
+ # @return Integer
33
+ attr_accessor :subscription_batch_size
34
+
32
35
  # @api private
33
36
  def initialize
34
37
  @on_unknown_event = proc { |event, aggregate|
@@ -40,6 +43,7 @@ module EventSourcery
40
43
  @event_builder = nil
41
44
  @event_type_serializer = EventStore::EventTypeSerializers::Underscored.new
42
45
  @error_handler_class = EventProcessing::ErrorHandlers::ConstantRetry
46
+ @subscription_batch_size = 1000
43
47
  end
44
48
 
45
49
  # Logger instance used by EventSourcery.
@@ -18,7 +18,8 @@ module EventSourcery
18
18
  event_types: nil,
19
19
  on_new_events:,
20
20
  subscription_master:,
21
- events_table_name: :events)
21
+ events_table_name: :events,
22
+ batch_size: EventSourcery.config.subscription_batch_size)
22
23
  @event_store = event_store
23
24
  @from_event_id = from_event_id
24
25
  @poll_waiter = poll_waiter
@@ -26,6 +27,7 @@ module EventSourcery
26
27
  @on_new_events = on_new_events
27
28
  @subscription_master = subscription_master
28
29
  @current_event_id = from_event_id - 1
30
+ @batch_size = batch_size
29
31
  end
30
32
 
31
33
  # Start listening for new events. This method will continue to listen for new events until a shutdown is requested
@@ -42,10 +44,12 @@ module EventSourcery
42
44
 
43
45
  private
44
46
 
47
+ attr_reader :batch_size
48
+
45
49
  def read_events
46
50
  loop do
47
51
  @subscription_master.shutdown_if_requested
48
- events = @event_store.get_next_from(@current_event_id + 1, event_types: @event_types)
52
+ events = @event_store.get_next_from(@current_event_id + 1, event_types: @event_types, limit: batch_size)
49
53
  break if events.empty?
50
54
  EventSourcery.logger.debug { "New events in subscription: #{events.inspect}" }
51
55
  @on_new_events.call(events)
@@ -1,4 +1,4 @@
1
1
  module EventSourcery
2
2
  # Defines the version
3
- VERSION = '0.17.0'.freeze
3
+ VERSION = '0.18.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.17.0
4
+ version: 0.18.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-03-21 00:00:00.000000000 Z
11
+ date: 2018-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  requirements: []
144
144
  rubyforge_project:
145
- rubygems_version: 2.6.14
145
+ rubygems_version: 2.5.2
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: Event Sourcing Library