evt-consumer 2.2.0.2 → 2.3.1.1

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: f1655677eabb7b620e0ea1a528d4b3406829041e560d32e803056c7c80926536
4
- data.tar.gz: 7b7c5126c3641c3c042ab3bb6f2ed870c5c5ce078e731cc60b681901097ebe41
3
+ metadata.gz: 017c30298e5d8a0a9fe23fa86e09c44323e1a22d52e3663969747a02e2436146
4
+ data.tar.gz: 29bd3ab2d3024ab66821a5234e7195e669fc1ae2425ca5eed29261ff7dedc366
5
5
  SHA512:
6
- metadata.gz: 7e9d3b6f759a77e5cb305d61a3f662aed1130e479ba9a14d504f8ed494f2e78e425984996b25518772097c3e830cdffdf355f8b06a89d4444f2e9bb72dae68d0
7
- data.tar.gz: 5121f4eb1a4cc6888e14afbb308b0b907d79013e07fdb5bb3bc314fc49451758c6b38280423efd0bb1be7ce1082b86b49baef7900a06f0187f3b0525e77a7e08
6
+ metadata.gz: 456d640e41bf8ed1a4d5fe81f81158eb49bb74d49447765d29c9e4d30f085506d36357724b6dd05d2b9a9241e5644d005e46993df344439f1b37a19efd81afb2
7
+ data.tar.gz: 35a6285dfe925119da75328deef4f4d58d8ce94e8a0bdfb0d250f1a3a21e4815dc0511e7b603f29cd6956a302785a9af6531b91d334a41b772471ad737a4c5fc
@@ -37,6 +37,8 @@ module Consumer
37
37
 
38
38
  attr_accessor :session
39
39
 
40
+ attr_accessor :supplemental_settings
41
+
40
42
  dependency :get, MessageStore::Get
41
43
  dependency :position_store, PositionStore
42
44
  dependency :subscription, Subscription
@@ -87,7 +89,7 @@ module Consumer
87
89
 
88
90
  print_startup_info if respond_to?(:print_startup_info)
89
91
 
90
- STDOUT.puts " Position Stream: #{position_store.stream_name}"
92
+ STDOUT.puts " Position Location: #{position_store.location || '(none)'}"
91
93
 
92
94
  STDOUT.puts
93
95
 
@@ -119,7 +121,7 @@ module Consumer
119
121
  logger.trace(tags: [:consumer, :dispatch, :message]) { "Dispatching message (#{LogText.message_data(message_data)})" }
120
122
 
121
123
  self.class.handler_registry.each do |handler|
122
- handler.(message_data, session: session)
124
+ handler.(message_data, session: session, settings: supplemental_settings)
123
125
  end
124
126
 
125
127
  update_position(message_data.global_position)
@@ -172,13 +174,21 @@ module Consumer
172
174
  end
173
175
 
174
176
  module Build
175
- def build(category, position_update_interval: nil, poll_interval_milliseconds: nil, identifier: nil, **arguments)
177
+ def build(category, position_update_interval: nil, poll_interval_milliseconds: nil, identifier: nil, supplemental_settings: nil, **arguments)
176
178
  instance = new(category)
177
179
 
178
- unless identifier.nil?
180
+ if not identifier.nil?
179
181
  instance.identifier = identifier
180
182
  end
181
183
 
184
+ if not supplemental_settings.nil?
185
+ if not supplemental_settings.is_a?(::Settings)
186
+ supplemental_settings = ::Settings.build(supplemental_settings)
187
+ end
188
+
189
+ instance.supplemental_settings = supplemental_settings
190
+ end
191
+
182
192
  instance.position_update_interval = position_update_interval
183
193
  instance.poll_interval_milliseconds = poll_interval_milliseconds
184
194
 
@@ -1,3 +1,4 @@
1
+ require 'settings/controls'
1
2
  require 'messaging/controls'
2
3
 
3
4
  require 'consumer/controls/category'
@@ -11,7 +12,7 @@ require 'consumer/controls/id'
11
12
  require 'consumer/controls/identifier'
12
13
  require 'consumer/controls/position'
13
14
  require 'consumer/controls/session'
14
- require 'consumer/controls/stream_name'
15
+ require 'consumer/controls/settings'
15
16
 
16
17
  require 'consumer/controls/position_store'
17
18
  require 'consumer/controls/position_store/file'
@@ -19,6 +20,7 @@ require 'consumer/controls/subscription'
19
20
 
20
21
  require 'consumer/controls/handle'
21
22
  require 'consumer/controls/handle/raise_error'
23
+ require 'consumer/controls/handle/settings'
22
24
 
23
25
  require 'consumer/controls/actor'
24
26
 
@@ -59,6 +59,14 @@ module Consumer
59
59
  end
60
60
 
61
61
  Example = self.example_class
62
+
63
+ module Settings
64
+ def self.example_class
65
+ Consumer.example_class(handlers: [Handle::Settings::Example])
66
+ end
67
+
68
+ Example = self.example_class
69
+ end
62
70
  end
63
71
  end
64
72
  end
@@ -15,7 +15,7 @@ module Consumer
15
15
  attr_accessor :failed_message
16
16
 
17
17
  handler Handle::Example
18
- handler Handle::RaiseError
18
+ handler Handle::RaiseError::Example
19
19
 
20
20
  def error_raised(error, message)
21
21
  self.handled_error = error
@@ -22,6 +22,10 @@ module Consumer
22
22
  instance
23
23
  end
24
24
 
25
+ def category
26
+ Category.example
27
+ end
28
+
25
29
  def batch_size
26
30
  Defaults.batch_size
27
31
  end
@@ -0,0 +1,26 @@
1
+ module Consumer
2
+ module Controls
3
+ module Handle
4
+ module Settings
5
+ Error = Class.new(RuntimeError)
6
+
7
+ class Example
8
+ include Messaging::Handle
9
+
10
+ include ::Settings::Setting
11
+ setting :some_setting
12
+
13
+ attr_accessor :some_other_setting
14
+
15
+ def configure(settings:)
16
+ settings.set(self)
17
+ end
18
+
19
+ def handle(message_data)
20
+ raise Settings::Error if some_setting.nil?
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,24 +1,35 @@
1
1
  module Consumer
2
2
  module Controls
3
3
  module PositionStore
4
- def self.example
5
- Example.build
4
+ def self.example(&block)
5
+ if block.nil?
6
+ cls = Example
7
+ else
8
+ cls = example_class(&block)
9
+ end
10
+
11
+ cls.build
6
12
  end
7
13
 
8
- class Example
9
- include ::Consumer::PositionStore
14
+ def self.example_class(&block)
15
+ Class.new do
16
+ include ::Consumer::PositionStore
10
17
 
11
- attr_accessor :telemetry_sink
18
+ def self.build
19
+ instance = new
20
+ instance.configure
21
+ instance
22
+ end
12
23
 
13
- def stream_name
14
- 'somePositionStream'
15
- end
24
+ def configure
25
+ end
16
26
 
17
- def self.build
18
- instance = new
19
- instance.configure
20
- instance
27
+ class_exec(&block) unless block.nil?
21
28
  end
29
+ end
30
+
31
+ Example = example_class do
32
+ attr_accessor :telemetry_sink
22
33
 
23
34
  def configure
24
35
  self.telemetry_sink = ::Consumer::PositionStore::Telemetry::Sink.new
@@ -33,6 +44,12 @@ module Consumer
33
44
  def put(_)
34
45
  end
35
46
  end
47
+
48
+ module Location
49
+ def self.example
50
+ 'somePositionStream'
51
+ end
52
+ end
36
53
  end
37
54
  end
38
55
  end
@@ -0,0 +1,13 @@
1
+ module Consumer
2
+ module Controls
3
+ module Settings
4
+ def self.example
5
+ ::Settings.build(data)
6
+ end
7
+
8
+ def self.data
9
+ ::Settings::Controls::Data::Flat::Single.example
10
+ end
11
+ end
12
+ end
13
+ end
@@ -3,6 +3,7 @@ module Consumer
3
3
  def self.included(cls)
4
4
  cls.class_exec do
5
5
  include Dependency
6
+ include Virtual
6
7
  include Log::Dependency
7
8
 
8
9
  extend Build
@@ -13,6 +14,8 @@ module Consumer
13
14
  prepend Put
14
15
 
15
16
  dependency :telemetry, ::Telemetry
17
+
18
+ virtual :location
16
19
  end
17
20
  end
18
21
 
@@ -6,6 +6,8 @@ module Consumer
6
6
  end
7
7
 
8
8
  class PositionStore
9
+ include Consumer::PositionStore
10
+
9
11
  attr_accessor :get_position
10
12
  attr_accessor :put_position
11
13
 
@@ -53,7 +53,7 @@ module Consumer
53
53
  end
54
54
 
55
55
  if batch.nil? || batch.empty?
56
- logger.debug { "Did not resupply; no events available (Category: #{get.category}, Position: #{position})" }
56
+ logger.debug { "Did not resupply; no events available (Stream: #{get.stream_name}, Position: #{position})" }
57
57
 
58
58
  :resupply
59
59
  else
@@ -2,6 +2,9 @@ module Consumer
2
2
  class Subscription
3
3
  module Defaults
4
4
  def self.poll_interval_milliseconds
5
+ env_interval = ENV['POLL_INTERVAL_MILLISECONDS']
6
+ return env_interval.to_i if !env_interval.nil?
7
+
5
8
  100
6
9
  end
7
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-consumer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0.2
4
+ version: 2.3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-17 00:00:00.000000000 Z
11
+ date: 2021-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ntl-actor
@@ -114,6 +114,7 @@ files:
114
114
  - lib/consumer/controls/get/incrementing.rb
115
115
  - lib/consumer/controls/handle.rb
116
116
  - lib/consumer/controls/handle/raise_error.rb
117
+ - lib/consumer/controls/handle/settings.rb
117
118
  - lib/consumer/controls/id.rb
118
119
  - lib/consumer/controls/identifier.rb
119
120
  - lib/consumer/controls/message_data.rb
@@ -123,7 +124,7 @@ files:
123
124
  - lib/consumer/controls/position_store.rb
124
125
  - lib/consumer/controls/position_store/file.rb
125
126
  - lib/consumer/controls/session.rb
126
- - lib/consumer/controls/stream_name.rb
127
+ - lib/consumer/controls/settings.rb
127
128
  - lib/consumer/controls/subscription.rb
128
129
  - lib/consumer/defaults.rb
129
130
  - lib/consumer/handler_registry.rb
@@ -132,8 +133,6 @@ files:
132
133
  - lib/consumer/position_store.rb
133
134
  - lib/consumer/position_store/substitute.rb
134
135
  - lib/consumer/position_store/telemetry.rb
135
- - lib/consumer/postgres
136
- - lib/consumer/postgres.rb
137
136
  - lib/consumer/subscription.rb
138
137
  - lib/consumer/subscription/defaults.rb
139
138
  - lib/consumer/subscription/get_batch.rb
@@ -142,7 +141,7 @@ homepage: https://github.com/eventide-project/consumer
142
141
  licenses:
143
142
  - MIT
144
143
  metadata: {}
145
- post_install_message:
144
+ post_install_message:
146
145
  rdoc_options: []
147
146
  require_paths:
148
147
  - lib
@@ -157,8 +156,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
156
  - !ruby/object:Gem::Version
158
157
  version: '0'
159
158
  requirements: []
160
- rubygems_version: 3.1.2
161
- signing_key:
159
+ rubygems_version: 3.2.15
160
+ signing_key:
162
161
  specification_version: 4
163
162
  summary: Continuous subscription to a category and message dispatching to handlers
164
163
  test_files: []
@@ -1,6 +0,0 @@
1
- ## Consider whether this is still needed after category rename
2
- module Consumer
3
- module Controls
4
- StreamName = Messaging::Controls::StreamName
5
- end
6
- end
@@ -1 +0,0 @@
1
- lib/consumer/Users/sbellware/projects/eventide/consumer-postgres/lib/consumer/postgres
@@ -1 +0,0 @@
1
- lib/consumer/Users/sbellware/projects/eventide/consumer-postgres/lib/consumer/postgres.rb