evt-consumer 0.5.0.0 → 0.5.0.1

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: 27284a1d79008240bec7a95e6c22807e994dac8b
4
- data.tar.gz: dbd8db5df89c7e511653f625f25c20de4d56cda5
3
+ metadata.gz: 2b7ba7639868951557d06b7a6c7fa66bf4141e3c
4
+ data.tar.gz: b7d2764110d1f64263e83871eab9e515b36c7002
5
5
  SHA512:
6
- metadata.gz: 4d8c11d563ad2d38c54fd962a42911ff8acb00cf178eb9eaad7cd6b69f02c731b848c72a29572141201842f3deb018c54f3239934cc104d3a94d5bc4e95f07fc
7
- data.tar.gz: 2e497f1d35244402f4b0ba5c105722a95187125c032cd5ae91d6210c2609517d710038fd0726f72a9fd3fbfcb215ff11df8c85c10461006cce5f91a04b99c57f
6
+ metadata.gz: cf143797978d8cfa068b6aea5232031c95c30339e189b0743675b50d74662217d3216916a87d54b1e1a5785067a642e08fe9321bab95cfd1ef1ca999956ed9a6
7
+ data.tar.gz: 6be8716feac2cf472d9c5226a7a312f5418b5a8431b9831d51ce536dc4c66f116884a3a2455dd75d2514aa008f90d2a63d4efa10b76a8585733e3b23ec18220a
@@ -25,8 +25,8 @@ module Consumer
25
25
 
26
26
  request_batch
27
27
 
28
- events.each do |event_data|
29
- consumer.(event_data)
28
+ events.each do |message_data|
29
+ consumer.(message_data)
30
30
  end
31
31
 
32
32
  logger.debug { "Batch received (Events: #{events.count})" }
@@ -28,18 +28,18 @@ module Consumer
28
28
  end
29
29
  end
30
30
 
31
- def call(event_data)
32
- logger.trace { "Dispatching event (#{LogText.event_data event_data})" }
31
+ def call(message_data)
32
+ logger.trace { "Dispatching event (#{LogText.message_data message_data})" }
33
33
 
34
- dispatch.(event_data)
34
+ dispatch.(message_data)
35
35
 
36
- update_position event_data.global_position
36
+ update_position message_data.global_position
37
37
 
38
- logger.info { "Event dispatched (#{LogText.event_data event_data})" }
38
+ logger.info { "Event dispatched (#{LogText.message_data message_data})" }
39
39
 
40
40
  rescue => error
41
- logger.error { "Error raised (Error Class: #{error.class}, Error Message: #{error.message}, #{LogText.event_data event_data})" }
42
- error_raised error, event_data
41
+ logger.error { "Error raised (Error Class: #{error.class}, Error Message: #{error.message}, #{LogText.message_data message_data})" }
42
+ error_raised error, message_data
43
43
  end
44
44
 
45
45
  def run(&probe)
@@ -103,8 +103,8 @@ module Consumer
103
103
  end
104
104
 
105
105
  module LogText
106
- def self.event_data(event_data)
107
- "Stream: #{event_data.stream_name}, Position: #{event_data.position}, GlobalPosition: #{event_data.global_position}, Type: #{event_data.type}"
106
+ def self.message_data(message_data)
107
+ "Stream: #{message_data.stream_name}, Position: #{message_data.position}, GlobalPosition: #{message_data.global_position}, Type: #{message_data.type}"
108
108
  end
109
109
  end
110
110
 
@@ -129,7 +129,7 @@ module Consumer
129
129
 
130
130
  dispatch = Dispatch.configure self, handlers
131
131
 
132
- logger.debug { "Configuring (Batch Size: #{batch_size}, Session: #{session.inspect})" }
132
+ logger.debug { "Done configuring (Batch Size: #{batch_size}, Session: #{session.inspect}, Starting Position: #{starting_position})" }
133
133
  end
134
134
  end
135
135
 
@@ -2,8 +2,8 @@ require 'messaging/controls'
2
2
 
3
3
  require 'consumer/controls/category'
4
4
  require 'consumer/controls/cycle'
5
- require 'consumer/controls/event_data'
6
- require 'consumer/controls/event_data/batch'
5
+ require 'consumer/controls/message_data'
6
+ require 'consumer/controls/message_data/batch'
7
7
  require 'consumer/controls/error'
8
8
  require 'consumer/controls/get'
9
9
  require 'consumer/controls/get/incrementing'
@@ -1,5 +1,5 @@
1
1
  module Consumer
2
2
  module Controls
3
- Category = EventSource::Controls::Category
3
+ Category = MessageStore::Controls::Category
4
4
  end
5
5
  end
@@ -8,12 +8,12 @@ module Consumer
8
8
  @logger ||= ::Log.get self
9
9
  end
10
10
 
11
- handler do |event_data|
12
- logger.info { "Handled event (StreamName: #{event_data.stream_name}, GlobalPosition: #{event_data.global_position})" }
11
+ handler do |message_data|
12
+ logger.info { "Handled event (StreamName: #{message_data.stream_name}, GlobalPosition: #{message_data.global_position})" }
13
13
  end
14
14
 
15
- handler do |event_data|
16
- logger.debug { event_data.data.pretty_inspect }
15
+ handler do |message_data|
16
+ logger.debug { message_data.data.pretty_inspect }
17
17
  end
18
18
 
19
19
  def configure(session: nil, batch_size: nil, position_store: nil)
@@ -16,7 +16,7 @@ module Consumer
16
16
  sleep Rational(sleep_duration, 1000)
17
17
 
18
18
  3.times.map do |offset|
19
- EventData.get(
19
+ MessageData.get(
20
20
  stream_name,
21
21
  position + offset,
22
22
  offset
@@ -25,11 +25,11 @@ module Consumer
25
25
  end
26
26
  end
27
27
 
28
- class EventData
28
+ class MessageData
29
29
  def self.get(stream_name, global_position, position)
30
30
  data = { :position => position, :global_position => global_position }
31
31
 
32
- Controls::EventData.example(
32
+ Controls::MessageData.example(
33
33
  stream_name: stream_name,
34
34
  data: data,
35
35
  global_position: global_position,
@@ -8,16 +8,16 @@ module Consumer
8
8
  class Example
9
9
  include Messaging::Handle
10
10
 
11
- def handle(event_data)
12
- handled_events << event_data
11
+ def handle(message_data)
12
+ handled_events << message_data
13
13
  end
14
14
 
15
15
  def handled_events
16
16
  @handled_events ||= []
17
17
  end
18
18
 
19
- def handled?(event_data)
20
- handled_events.include? event_data
19
+ def handled?(message_data)
20
+ handled_events.include? message_data
21
21
  end
22
22
  end
23
23
  end
@@ -0,0 +1,15 @@
1
+ module Consumer
2
+ module Controls
3
+ module MessageData
4
+ def self.example(stream_name: nil, data: nil, position: nil, global_position: nil)
5
+ global_position ||= position
6
+
7
+ message_data = MessageStore::Controls::MessageData::Read.example(data: data)
8
+ message_data.stream_name = stream_name unless stream_name.nil?
9
+ message_data.position = position unless position.nil?
10
+ message_data.global_position = global_position unless global_position.nil?
11
+ message_data
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,6 +1,6 @@
1
1
  module Consumer
2
2
  module Controls
3
- module EventData
3
+ module MessageData
4
4
  module Batch
5
5
  def self.example(instances: nil, position: nil)
6
6
  instances ||= size
@@ -9,7 +9,7 @@ module Consumer
9
9
  instances.times.map do |offset|
10
10
  position = start_position + offset
11
11
 
12
- EventData.example global_position: position
12
+ MessageData.example(global_position: position)
13
13
  end
14
14
  end
15
15
 
@@ -3,7 +3,7 @@ module Consumer
3
3
  module Position
4
4
  module Stream
5
5
  def self.example
6
- EventSource::Controls::EventData.position
6
+ MessageStore::Controls::MessageData.position
7
7
  end
8
8
  end
9
9
 
@@ -11,7 +11,7 @@ module Consumer
11
11
  def self.example(offset: nil)
12
12
  offset ||= 0
13
13
 
14
- position = EventSource::Controls::EventData::Read.global_position
14
+ position = MessageStore::Controls::MessageData::Read.global_position
15
15
 
16
16
  position + offset
17
17
  end
@@ -16,14 +16,14 @@ module Consumer
16
16
  instance
17
17
  end
18
18
 
19
- def call(event_data)
20
- logger.trace { "Dispatching event (#{LogText.event_data event_data})" }
19
+ def call(message_data)
20
+ logger.trace { "Dispatching event (#{LogText.message_data message_data})" }
21
21
 
22
22
  handlers.each do |handle|
23
- handle.(event_data)
23
+ handle.(message_data)
24
24
  end
25
25
 
26
- logger.debug { "Event dispatched (#{LogText.event_data event_data}, Handlers Count: #{handlers.count})" }
26
+ logger.debug { "Event dispatched (#{LogText.message_data message_data}, Handlers Count: #{handlers.count})" }
27
27
 
28
28
  nil
29
29
  end
@@ -6,8 +6,8 @@ module Consumer
6
6
  end
7
7
 
8
8
  class Dispatch
9
- def call(event_data)
10
- dispatched_events << event_data
9
+ def call(message_data)
10
+ dispatched_events << message_data
11
11
  end
12
12
 
13
13
  def add_handler(handle)
@@ -18,11 +18,11 @@ module Consumer
18
18
  @dispatched_events ||= []
19
19
  end
20
20
 
21
- def dispatched?(event_data=nil, &block)
22
- if event_data.nil?
21
+ def dispatched?(message_data=nil, &block)
22
+ if message_data.nil?
23
23
  block ||= proc { true }
24
24
  else
25
- block ||= proc { |e| event_data == e }
25
+ block ||= proc { |e| message_data == e }
26
26
  end
27
27
 
28
28
  dispatched_events.any? &block
@@ -23,8 +23,8 @@ module Consumer
23
23
  def get(consumer)
24
24
  entries.map do |handler|
25
25
  if handler.is_a? Proc
26
- proc { |event_data|
27
- consumer.instance_exec event_data, &handler
26
+ proc { |message_data|
27
+ consumer.instance_exec message_data, &handler
28
28
  }
29
29
  else
30
30
  handler.build
@@ -1,7 +1,7 @@
1
1
  module Consumer
2
2
  module LogText
3
- def self.event_data(event_data)
4
- "Stream: #{event_data.stream_name}, Position: #{event_data.position}, GlobalPosition: #{event_data.global_position}, Type: #{event_data.type}"
3
+ def self.message_data(message_data)
4
+ "Stream: #{message_data.stream_name}, Position: #{message_data.position}, GlobalPosition: #{message_data.global_position}, Type: #{message_data.type}"
5
5
  end
6
6
  end
7
7
  end
@@ -61,7 +61,7 @@ module Consumer
61
61
 
62
62
  position = super
63
63
 
64
- logger.debug { "Get position done (Position: #{position || '(none)'})" }
64
+ logger.info { "Get position done (Position: #{position || '(none)'})" }
65
65
 
66
66
  telemetry.record :get, Telemetry::Get.new(position)
67
67
 
@@ -79,7 +79,7 @@ module Consumer
79
79
 
80
80
  super
81
81
 
82
- logger.debug { "Put position done (Position: #{position})" }
82
+ logger.info { "Put position done (Position: #{position})" }
83
83
 
84
84
  telemetry.record :put, Telemetry::Put.new(position)
85
85
 
@@ -5,19 +5,19 @@ module Consumer
5
5
  end
6
6
 
7
7
  class Consumer
8
- def call(event_data)
9
- consumed_events << event_data
8
+ def call(message_data)
9
+ consumed_events << message_data
10
10
  end
11
11
 
12
12
  def consumed_events
13
13
  @consumed_events ||= []
14
14
  end
15
15
 
16
- def consumed?(event_data=nil, &block)
17
- if event_data.nil?
16
+ def consumed?(message_data=nil, &block)
17
+ if message_data.nil?
18
18
  block ||= proc { true }
19
19
  else
20
- block ||= proc { |e| event_data == e }
20
+ block ||= proc { |e| message_data == e }
21
21
  end
22
22
 
23
23
  consumed_events.any? &block
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: 0.5.0.0
4
+ version: 0.5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-01 00:00:00.000000000 Z
11
+ date: 2017-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ntl-actor
@@ -95,12 +95,12 @@ files:
95
95
  - lib/consumer/controls/consumer/incrementing.rb
96
96
  - lib/consumer/controls/cycle.rb
97
97
  - lib/consumer/controls/error.rb
98
- - lib/consumer/controls/event_data.rb
99
- - lib/consumer/controls/event_data/batch.rb
100
98
  - lib/consumer/controls/get.rb
101
99
  - lib/consumer/controls/get/incrementing.rb
102
100
  - lib/consumer/controls/handle.rb
103
101
  - lib/consumer/controls/id.rb
102
+ - lib/consumer/controls/message_data.rb
103
+ - lib/consumer/controls/message_data/batch.rb
104
104
  - lib/consumer/controls/position.rb
105
105
  - lib/consumer/controls/position_store.rb
106
106
  - lib/consumer/controls/position_store/local_file.rb
@@ -131,7 +131,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
131
  requirements:
132
132
  - - ">="
133
133
  - !ruby/object:Gem::Version
134
- version: 2.3.3
134
+ version: 2.4.0
135
135
  required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ">="
@@ -1,15 +0,0 @@
1
- module Consumer
2
- module Controls
3
- module EventData
4
- def self.example(stream_name: nil, data: nil, position: nil, global_position: nil)
5
- global_position ||= position
6
-
7
- event_data = EventSource::Controls::EventData::Read.example data: data
8
- event_data.stream_name = stream_name unless stream_name.nil?
9
- event_data.position = position unless position.nil?
10
- event_data.global_position = global_position unless global_position.nil?
11
- event_data
12
- end
13
- end
14
- end
15
- end