eventhub-processor2 1.5.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- require_relative 'base'
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
- get_name_from_class(self)
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 'need to be implemented in derived class'
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: [ self ]},
90
- {type: ActorListener, as: :actor_listener, args: [ self ]}
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
- case
110
- when SIGNALS_FOR_TERMINATION.include?(command)
111
- EventHub.logger.info("Command [#{command}] received")
112
- @sleeper.stop
113
- break
114
- when 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
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
- sleep 0.5
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
 
@@ -8,7 +8,7 @@ module EventHub
8
8
  end
9
9
 
10
10
  def stop
11
- @writer.close if @writer and !@writer.closed?
11
+ @writer.close if @writer && !@writer.closed?
12
12
  end
13
13
  end
14
14
  end
@@ -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
- begin
16
- start = Time.now
17
- yield
18
- success(Time.now - start, size)
19
- rescue
20
- failure
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)
@@ -1,3 +1,3 @@
1
1
  module EventHub
2
- VERSION = '1.5.0'.freeze
2
+ VERSION = "1.11.0".freeze
3
3
  end
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.5.0
4
+ version: 1.11.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: 2018-12-20 00:00:00.000000000 Z
11
+ date: 2021-05-01 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.17'
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.17'
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.12'
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.12'
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.17'
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.17'
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: '12.3'
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: '12.3'
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.8'
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.8'
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.16'
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.16'
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
@@ -129,8 +143,10 @@ executables: []
129
143
  extensions: []
130
144
  extra_rdoc_files: []
131
145
  files:
146
+ - ".codeclimate.yml"
132
147
  - ".gitignore"
133
148
  - ".rspec"
149
+ - ".ruby-version"
134
150
  - ".travis.yml"
135
151
  - CHANGELOG.md
136
152
  - Gemfile
@@ -145,6 +161,7 @@ files:
145
161
  - docker/definitions.json
146
162
  - docker/docker-compose.yml
147
163
  - docker/rabbitmq.config
164
+ - docker/reset
148
165
  - eventhub-processor2.gemspec
149
166
  - example/README.md
150
167
  - example/config/receiver.json
@@ -174,7 +191,7 @@ homepage: https://github.com/thomis/eventhub-processor2
174
191
  licenses:
175
192
  - MIT
176
193
  metadata: {}
177
- post_install_message:
194
+ post_install_message:
178
195
  rdoc_options: []
179
196
  require_paths:
180
197
  - lib
@@ -189,9 +206,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
206
  - !ruby/object:Gem::Version
190
207
  version: '0'
191
208
  requirements: []
192
- rubyforge_project:
193
- rubygems_version: 2.6.14
194
- signing_key:
209
+ rubygems_version: 3.0.3
210
+ signing_key:
195
211
  specification_version: 4
196
212
  summary: Next generation gem to build ruby based eventhub processor
197
213
  test_files: []