evt-consumer 0.0.0.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 +7 -0
- data/lib/consumer.rb +11 -0
- data/lib/consumer/consumer.rb +18 -0
- data/lib/consumer/controls.rb +12 -0
- data/lib/consumer/controls/category.rb +5 -0
- data/lib/consumer/controls/consumer.rb +15 -0
- data/lib/consumer/controls/event_data.rb +13 -0
- data/lib/consumer/controls/id.rb +5 -0
- data/lib/consumer/controls/position.rb +17 -0
- data/lib/consumer/controls/position_store.rb +30 -0
- data/lib/consumer/controls/stream.rb +5 -0
- data/lib/consumer/controls/stream_name.rb +5 -0
- data/lib/consumer/log.rb +11 -0
- data/lib/consumer/position_store.rb +69 -0
- data/lib/consumer/position_store/telemetry.rb +15 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1d47d76ca72a1690d983e55f05254d16a7020586
|
4
|
+
data.tar.gz: 30e729d41f0db67cc91f1703cfa6e18e3c82988d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c82b2f96df0c299d64e05c264d4a1193fa91768da0b79bdee5ff7fb852bbd0b5e1ed526b5a2c436bb3844b0ddb2a2276a8a36b5a34061d6d45aeec1f8eef3c5b
|
7
|
+
data.tar.gz: 1e6372fb092c037a2581e4890614a8858f3b71ffddf6a555cb71c6870539e67787b650006baca0d2661fec04bd67a93396bbeee1f00a864f04013749ede15a5f
|
data/lib/consumer.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Consumer
|
2
|
+
def self.included(cls)
|
3
|
+
cls.class_exec do
|
4
|
+
extend StreamMacro
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
module StreamMacro
|
9
|
+
def stream_macro(stream_name)
|
10
|
+
stream = EventSource::Stream.new stream_name
|
11
|
+
|
12
|
+
define_method :stream do
|
13
|
+
stream
|
14
|
+
end
|
15
|
+
end
|
16
|
+
alias_method :stream, :stream_macro
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'messaging/controls'
|
2
|
+
|
3
|
+
require 'consumer/controls/category'
|
4
|
+
require 'consumer/controls/event_data'
|
5
|
+
require 'consumer/controls/id'
|
6
|
+
require 'consumer/controls/position'
|
7
|
+
require 'consumer/controls/stream'
|
8
|
+
require 'consumer/controls/stream_name'
|
9
|
+
|
10
|
+
require 'consumer/controls/position_store'
|
11
|
+
|
12
|
+
require 'consumer/controls/consumer'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Consumer
|
2
|
+
module Controls
|
3
|
+
module EventData
|
4
|
+
def self.example(stream_name: nil, position: nil, global_position: nil)
|
5
|
+
event_data = EventSource::Controls::EventData::Read.example
|
6
|
+
event_data.stream_name = stream_name unless stream_name.nil?
|
7
|
+
event_data.position = position unless position.nil?
|
8
|
+
event_data.global_position unless global_position.nil?
|
9
|
+
event_data
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Consumer
|
2
|
+
module Controls
|
3
|
+
module Position
|
4
|
+
module Stream
|
5
|
+
def self.example
|
6
|
+
EventSource::Controls::EventData.position
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
module Global
|
11
|
+
def self.example
|
12
|
+
EventSource::Controls::EventData::Read.global_position
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Consumer
|
2
|
+
module Controls
|
3
|
+
module PositionStore
|
4
|
+
def self.example
|
5
|
+
stream_name = StreamName.example
|
6
|
+
|
7
|
+
Example.build stream_name
|
8
|
+
end
|
9
|
+
|
10
|
+
class Example
|
11
|
+
include ::Consumer::PositionStore
|
12
|
+
|
13
|
+
attr_accessor :telemetry_sink
|
14
|
+
|
15
|
+
def configure
|
16
|
+
self.telemetry_sink = ::Consumer::PositionStore::Telemetry::Sink.new
|
17
|
+
|
18
|
+
telemetry.register telemetry_sink
|
19
|
+
end
|
20
|
+
|
21
|
+
def get
|
22
|
+
Position::Global.example
|
23
|
+
end
|
24
|
+
|
25
|
+
def put(_)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/consumer/log.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
module Consumer
|
2
|
+
module PositionStore
|
3
|
+
def self.included(cls)
|
4
|
+
cls.class_exec do
|
5
|
+
include Log::Dependency
|
6
|
+
|
7
|
+
extend Build
|
8
|
+
|
9
|
+
prepend Get
|
10
|
+
prepend Put
|
11
|
+
|
12
|
+
configure :position_store
|
13
|
+
|
14
|
+
initializer :stream
|
15
|
+
|
16
|
+
dependency :telemetry, ::Telemetry
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Virtual::Method.define self, :configure
|
21
|
+
|
22
|
+
module Get
|
23
|
+
def self.prepended(cls)
|
24
|
+
Virtual::PureMethod.define cls, :get
|
25
|
+
end
|
26
|
+
|
27
|
+
def get
|
28
|
+
logger.trace { "Get position (Stream: #{stream.name})" }
|
29
|
+
|
30
|
+
position = super
|
31
|
+
|
32
|
+
logger.debug { "Get position done (Stream: #{stream.name}, Position: #{position})" }
|
33
|
+
|
34
|
+
telemetry.record :get, Telemetry::Get.new(position, stream)
|
35
|
+
|
36
|
+
position
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
module Put
|
41
|
+
def self.prepended(cls)
|
42
|
+
Virtual::Method.define cls, :put
|
43
|
+
end
|
44
|
+
|
45
|
+
def put(position)
|
46
|
+
logger.trace { "Put position (Stream: #{stream.name}, Position: #{position})" }
|
47
|
+
|
48
|
+
super
|
49
|
+
|
50
|
+
logger.debug { "Put position done (Stream: #{stream.name}, Position: #{position})" }
|
51
|
+
|
52
|
+
telemetry.record :put, Telemetry::Put.new(position, stream)
|
53
|
+
|
54
|
+
nil
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
module Build
|
59
|
+
def build(stream)
|
60
|
+
stream = EventSource::Stream.canonize stream
|
61
|
+
|
62
|
+
instance = new stream
|
63
|
+
::Telemetry.configure instance
|
64
|
+
instance.configure
|
65
|
+
instance
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: evt-consumer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- The Eventide Project
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-01-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ntl-actor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: evt-configure
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: evt-messaging
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: test_bench
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: " "
|
70
|
+
email: opensource@eventide-project.org
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files: []
|
74
|
+
files:
|
75
|
+
- lib/consumer.rb
|
76
|
+
- lib/consumer/consumer.rb
|
77
|
+
- lib/consumer/controls.rb
|
78
|
+
- lib/consumer/controls/category.rb
|
79
|
+
- lib/consumer/controls/consumer.rb
|
80
|
+
- lib/consumer/controls/event_data.rb
|
81
|
+
- lib/consumer/controls/id.rb
|
82
|
+
- lib/consumer/controls/position.rb
|
83
|
+
- lib/consumer/controls/position_store.rb
|
84
|
+
- lib/consumer/controls/stream.rb
|
85
|
+
- lib/consumer/controls/stream_name.rb
|
86
|
+
- lib/consumer/log.rb
|
87
|
+
- lib/consumer/position_store.rb
|
88
|
+
- lib/consumer/position_store/telemetry.rb
|
89
|
+
homepage: https://github.com/eventide-project/consumer
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.3.3
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.6.8
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Consumer library that maintains a long running subscription to an event stream
|
113
|
+
test_files: []
|