eventhub-processor2 1.4.1 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rspec +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -4
- data/CHANGELOG.md +26 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +64 -52
- data/README.md +13 -2
- data/Rakefile +13 -4
- data/docker/Dockerfile +5 -3
- data/docker/README.md +2 -2
- data/docker/definitions.json +44 -1
- data/docker/docker-compose.yml +11 -0
- data/docker/reset +5 -0
- data/eventhub-processor2.gemspec +24 -23
- data/example/crasher.rb +12 -13
- data/example/publisher.rb +41 -41
- data/example/receiver.rb +2 -2
- data/example/router.rb +3 -3
- data/lib/eventhub/actor_heartbeat.rb +22 -23
- data/lib/eventhub/actor_listener.rb +18 -23
- data/lib/eventhub/actor_publisher.rb +7 -7
- data/lib/eventhub/actor_watchdog.rb +3 -4
- data/lib/eventhub/base.rb +24 -31
- data/lib/eventhub/base_exception.rb +2 -2
- data/lib/eventhub/configuration.rb +31 -26
- data/lib/eventhub/constant.rb +24 -24
- data/lib/eventhub/hash_extensions.rb +8 -8
- data/lib/eventhub/helper.rb +7 -7
- data/lib/eventhub/logger.rb +2 -2
- data/lib/eventhub/message.rb +45 -45
- data/lib/eventhub/processor2.rb +22 -22
- data/lib/eventhub/sleeper.rb +1 -1
- data/lib/eventhub/statistics.rb +6 -9
- data/lib/eventhub/version.rb +1 -1
- metadata +35 -19
data/lib/eventhub/processor2.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "base"
|
2
2
|
|
3
3
|
# EventHub module
|
4
4
|
module EventHub
|
@@ -15,7 +15,7 @@ module EventHub
|
|
15
15
|
def initialize(args = {})
|
16
16
|
# Set processor name
|
17
17
|
EventHub::Configuration.name = args[:name] ||
|
18
|
-
|
18
|
+
get_name_from_class(self)
|
19
19
|
|
20
20
|
# Parse comand line options
|
21
21
|
EventHub::Configuration.parse_options
|
@@ -54,7 +54,7 @@ module EventHub
|
|
54
54
|
# get message as EventHub::Message class instance
|
55
55
|
# args contain :queue_name, :content_type, :priority, :delivery_tag
|
56
56
|
def handle_message(_message, _args = {})
|
57
|
-
raise
|
57
|
+
raise "need to be implemented in derived class"
|
58
58
|
end
|
59
59
|
|
60
60
|
# pass message as string like: '{ "header": ... , "body": { .. }}'
|
@@ -86,8 +86,8 @@ module EventHub
|
|
86
86
|
|
87
87
|
def start_supervisor
|
88
88
|
@config = Celluloid::Supervision::Configuration.define([
|
89
|
-
{type: ActorHeartbeat, as: :actor_heartbeat, args: [
|
90
|
-
{type: ActorListener, as: :actor_listener, args: [
|
89
|
+
{type: ActorHeartbeat, as: :actor_heartbeat, args: [self]},
|
90
|
+
{type: ActorListener, as: :actor_listener, args: [self]}
|
91
91
|
])
|
92
92
|
|
93
93
|
sleeper = @sleeper
|
@@ -95,34 +95,34 @@ module EventHub
|
|
95
95
|
restart_in_s = Configuration.processor[:restart_in_s]
|
96
96
|
EventHub.logger.info("Restarting in #{restart_in_s} seconds...")
|
97
97
|
sleeper.start(restart_in_s)
|
98
|
-
end
|
98
|
+
end)
|
99
99
|
|
100
100
|
@config.deploy
|
101
101
|
end
|
102
102
|
|
103
103
|
def main_event_loop
|
104
|
+
Celluloid.boot
|
104
105
|
setup_signal_handler
|
105
106
|
start_supervisor
|
106
107
|
|
107
108
|
loop do
|
108
109
|
command = @command_queue.pop
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
Celluloid::Actor[:actor_listener].async.restart
|
121
|
-
else
|
122
|
-
EventHub.logger.info('Was unable to get a valid listener actor to restart... check!!!')
|
123
|
-
end
|
110
|
+
if SIGNALS_FOR_TERMINATION.include?(command)
|
111
|
+
EventHub.logger.info("Command [#{command}] received")
|
112
|
+
@sleeper.stop
|
113
|
+
break
|
114
|
+
elsif SIGNALS_FOR_RELOAD_CONFIG.include?(command)
|
115
|
+
EventHub::Configuration.load!
|
116
|
+
EventHub.logger.info("Configuration file reloaded")
|
117
|
+
|
118
|
+
# restart listener when actor is known
|
119
|
+
if Celluloid::Actor[:actor_listener]
|
120
|
+
Celluloid::Actor[:actor_listener].async.restart
|
124
121
|
else
|
125
|
-
|
122
|
+
EventHub.logger.info("Was unable to get a valid listener actor to restart... check!!!")
|
123
|
+
end
|
124
|
+
else
|
125
|
+
sleep 0.5
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
data/lib/eventhub/sleeper.rb
CHANGED
data/lib/eventhub/statistics.rb
CHANGED
@@ -10,16 +10,13 @@ class EventHub::Statistics
|
|
10
10
|
@mutex = Mutex.new
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
13
|
def measure(size, &block)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
raise
|
22
|
-
end
|
14
|
+
start = Time.now
|
15
|
+
yield
|
16
|
+
success(Time.now - start, size)
|
17
|
+
rescue
|
18
|
+
failure
|
19
|
+
raise
|
23
20
|
end
|
24
21
|
|
25
22
|
def success(process_time, size)
|
data/lib/eventhub/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventhub-processor2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steiner, Thomas
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.18'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.18'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bunny
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2.
|
33
|
+
version: '2.15'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '2.
|
40
|
+
version: '2.15'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: eventhub-components
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,56 +72,70 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1
|
75
|
+
version: '2.1'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1
|
82
|
+
version: '2.1'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '13.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '13.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '3.
|
103
|
+
version: '3.9'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '3.
|
110
|
+
version: '3.9'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0.
|
117
|
+
version: '0.21'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.21'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: standardrb
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.0'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0
|
138
|
+
version: '1.0'
|
125
139
|
description: Next generation gem to build ruby based eventhub processor
|
126
140
|
email:
|
127
141
|
- thomas.steiner@ikey.ch
|
@@ -131,6 +145,7 @@ extra_rdoc_files: []
|
|
131
145
|
files:
|
132
146
|
- ".gitignore"
|
133
147
|
- ".rspec"
|
148
|
+
- ".ruby-version"
|
134
149
|
- ".travis.yml"
|
135
150
|
- CHANGELOG.md
|
136
151
|
- Gemfile
|
@@ -143,7 +158,9 @@ files:
|
|
143
158
|
- docker/Dockerfile
|
144
159
|
- docker/README.md
|
145
160
|
- docker/definitions.json
|
161
|
+
- docker/docker-compose.yml
|
146
162
|
- docker/rabbitmq.config
|
163
|
+
- docker/reset
|
147
164
|
- eventhub-processor2.gemspec
|
148
165
|
- example/README.md
|
149
166
|
- example/config/receiver.json
|
@@ -173,7 +190,7 @@ homepage: https://github.com/thomis/eventhub-processor2
|
|
173
190
|
licenses:
|
174
191
|
- MIT
|
175
192
|
metadata: {}
|
176
|
-
post_install_message:
|
193
|
+
post_install_message:
|
177
194
|
rdoc_options: []
|
178
195
|
require_paths:
|
179
196
|
- lib
|
@@ -188,9 +205,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
205
|
- !ruby/object:Gem::Version
|
189
206
|
version: '0'
|
190
207
|
requirements: []
|
191
|
-
|
192
|
-
|
193
|
-
signing_key:
|
208
|
+
rubygems_version: 3.0.3
|
209
|
+
signing_key:
|
194
210
|
specification_version: 4
|
195
211
|
summary: Next generation gem to build ruby based eventhub processor
|
196
212
|
test_files: []
|