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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d443ae6e463ea7e17ccec2444f16fca2c9bc87c1
4
- data.tar.gz: 2b389166dc8a59eda6050016db10c56381c03549
2
+ SHA256:
3
+ metadata.gz: b42dd8fd5a7607df2058a6f5cc6de7d7ca6b78bb8165ffb98749f95a4ac0a981
4
+ data.tar.gz: e76356ff1d27ed40bd89db3377a8f3981865c9cb7721044d2ae1a30aaaafb5c4
5
5
  SHA512:
6
- metadata.gz: e02752c57a08fbf0898387ba90848cb6bdc96fc1307101eecc85fd264f5a63708949216d56d7cf2dc751d709a58f05361352f3e84c431e139277fe44d5aed2fd
7
- data.tar.gz: bafcb2ef32e3d7c05e59b47db26042808087058e848c11e4428297cc115cc38aceb38a2ffa87f5f706435b298891c7daff47f827c09f44189b0e7fe0cdae83c9
6
+ metadata.gz: 5aef448a233fbe8f7e986b701f0680d105c31112b82befbaeaa4a56d8cab7f4ea0c38563005889ea2181aebb3a1de7804c19634d7377ae5f651503695e4ffbf3
7
+ data.tar.gz: 0e560666d538df0fb14bcd78d44b591b257a43155d0159aadf11cedfa2ba60bd1cf411b2af5cffea81b8c8561436cbb6bd969a119582e3004ac2c953e14eaefa
data/.codeclimate.yml ADDED
@@ -0,0 +1,4 @@
1
+ plugins:
2
+ rubocop:
3
+ enabled: true
4
+ channel: rubocop-1-9-1
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
+ --format documentation
1
2
  --color
2
3
  --require spec_helper
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.6.6
data/.travis.yml CHANGED
@@ -9,9 +9,10 @@ os:
9
9
  - linux
10
10
 
11
11
  rvm:
12
- - 2.5.0
13
- - 2.4.3
14
- - 2.3.6
12
+ - 3.0.0
13
+ - 2.7.2
14
+ - 2.6.6
15
+ - 2.5.8
15
16
 
16
17
  env:
17
18
  - secure: R0rBtWClmnJKO+zyAncF6+1qDpZ6JQR+Z6VXzUmWw8MuxUXv732XTNYulY/tTeDW876GofAsOF9QfX/jhF+2ubV8SzM6rKTZS09feATuOWRPtECEaBOPcb0JGYouBNg/Lv4onuXb8KS/9U093sRqiJMfib82iY7QK9bnDPsYoQXtMnI7KBeQNrTV0H4nby3lvbjcpMDhmyg+anOmCP5yepZeS53Qq+C5GHguYivisvhSPmCfONrT303XxFLDo/aOkMDlceeZBDhtcpm5Px3GIwybSI9xRtAnpT73oL1Piazda6mRN7VHoT7YAHKqcJNZDB48HYuTj3Pt3oVVw0v78Cf25caBqXttXflXfB8U3qfVt+94uF0icH34NAnpW9l1B8GXHi6CTr27Hg2ZatWkQCN1rCpcCaW0eM/NoAG6snwTIwr1VvjLWpSW5wwhQgHPyMl+MRlTmCn/UM+eQSwPVhflKpMS1+ah6cbhDrQQF1jDt3dRaLqSnVE4APrafdT90SA3SCG2MGOE+pp+DX528gEsRB34UdX2V67dlwXeRu1eU5vZBR7jZrqwuwTAgSvxEF0eJWC0kgvEfouzuVHhVmmSAcNNHlg2kd0/oyQELyXTsklJghwAupcy4X/GEAyfLW9GAxItjATyV7XyfjmaBmdzHl/5JWeXicoyZ/4+8iE=
@@ -23,7 +24,7 @@ before_install:
23
24
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
24
25
  > ./cc-test-reporter
25
26
  - chmod +x ./cc-test-reporter
26
- - gem install bundler --version '~> 1.16.0'
27
+ - gem install bundler --version '~> 2.1.2'
27
28
 
28
29
  before_script:
29
30
  - "./cc-test-reporter before-build"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # Changelog of EventHub::Processor2
2
2
 
3
+ ## 1.11.0 / 2021-05-01
4
+
5
+ * Updated gem dependencies
6
+
7
+ ## 1.10.0 / 2021-03-11
8
+
9
+ * Updated to have less log noise
10
+ * Updated to stable tests
11
+
12
+ ## 1.9.0 / 2021-02-26
13
+
14
+ * Updated gem dependencies
15
+ * Appply ruby style guides
16
+ * Reduce log noice
17
+
18
+ ## 1.8.0 / 2020-05-05
19
+
20
+ * Increase watchdog cycle time to 60s
21
+ * Upgrade gem and gem dev dependencies
22
+ * Upgrade travis ruby version to test
23
+
24
+ ## 1.7.0 / 2020-02-28
25
+
26
+ * Upgrade dependencies: bundler 2.1, rake 13.0, rspec 3.9, simplecov 0.18
27
+ * status_message always as string for general exception handling
28
+ * fix rspec tests
29
+
30
+ ## 1.6.0 / 2019-02-20
31
+
32
+ * Upgrade dependencies: bunny 2.14, bundler 2.0
33
+
3
34
  ## 1.5.0 / 2018-12-20
4
35
 
5
36
  * Upgrade dependencies: rspec 3.8, bunny 2.12, bundler 1.17, simplecov 0.16
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
data/Gemfile.lock CHANGED
@@ -1,74 +1,89 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eventhub-processor2 (1.5.0)
5
- bunny (~> 2.12)
6
- celluloid (~> 0.17)
4
+ eventhub-processor2 (1.11.0)
5
+ bunny (~> 2.15)
6
+ celluloid (~> 0.18)
7
7
  eventhub-components (~> 0.2)
8
8
  uuidtools (~> 2.1)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- amq-protocol (2.3.0)
14
- bunny (2.12.1)
15
- amq-protocol (~> 2.3, >= 2.3.0)
16
- celluloid (0.17.3)
17
- celluloid-essentials
18
- celluloid-extras
19
- celluloid-fsm
20
- celluloid-pool
21
- celluloid-supervision
22
- timers (>= 4.1.1)
23
- celluloid-essentials (0.20.5)
24
- timers (>= 4.1.1)
25
- celluloid-extras (0.20.5)
26
- timers (>= 4.1.1)
27
- celluloid-fsm (0.20.5)
28
- timers (>= 4.1.1)
29
- celluloid-pool (0.20.5)
30
- timers (>= 4.1.1)
31
- celluloid-supervision (0.20.6)
32
- timers (>= 4.1.1)
33
- diff-lcs (1.3)
34
- docile (1.3.1)
13
+ amq-protocol (2.3.2)
14
+ ast (2.4.2)
15
+ bunny (2.17.0)
16
+ amq-protocol (~> 2.3, >= 2.3.1)
17
+ celluloid (0.18.0)
18
+ timers (~> 4)
19
+ diff-lcs (1.4.4)
20
+ docile (1.3.5)
35
21
  eventhub-components (0.2.2)
36
22
  logstash-logger (~> 0.26)
37
- json (2.1.0)
38
23
  logstash-event (1.2.02)
39
24
  logstash-logger (0.26.1)
40
25
  logstash-event (~> 1.2)
41
- rake (12.3.0)
42
- rspec (3.8.0)
43
- rspec-core (~> 3.8.0)
44
- rspec-expectations (~> 3.8.0)
45
- rspec-mocks (~> 3.8.0)
46
- rspec-core (3.8.0)
47
- rspec-support (~> 3.8.0)
48
- rspec-expectations (3.8.2)
26
+ parallel (1.20.1)
27
+ parser (3.0.1.0)
28
+ ast (~> 2.4.1)
29
+ rainbow (3.0.0)
30
+ rake (13.0.3)
31
+ regexp_parser (2.1.1)
32
+ rexml (3.2.5)
33
+ rspec (3.10.0)
34
+ rspec-core (~> 3.10.0)
35
+ rspec-expectations (~> 3.10.0)
36
+ rspec-mocks (~> 3.10.0)
37
+ rspec-core (3.10.1)
38
+ rspec-support (~> 3.10.0)
39
+ rspec-expectations (3.10.1)
49
40
  diff-lcs (>= 1.2.0, < 2.0)
50
- rspec-support (~> 3.8.0)
51
- rspec-mocks (3.8.0)
41
+ rspec-support (~> 3.10.0)
42
+ rspec-mocks (3.10.2)
52
43
  diff-lcs (>= 1.2.0, < 2.0)
53
- rspec-support (~> 3.8.0)
54
- rspec-support (3.8.0)
55
- simplecov (0.16.1)
44
+ rspec-support (~> 3.10.0)
45
+ rspec-support (3.10.2)
46
+ rubocop (1.12.1)
47
+ parallel (~> 1.10)
48
+ parser (>= 3.0.0.0)
49
+ rainbow (>= 2.2.2, < 4.0)
50
+ regexp_parser (>= 1.8, < 3.0)
51
+ rexml
52
+ rubocop-ast (>= 1.2.0, < 2.0)
53
+ ruby-progressbar (~> 1.7)
54
+ unicode-display_width (>= 1.4.0, < 3.0)
55
+ rubocop-ast (1.4.1)
56
+ parser (>= 2.7.1.5)
57
+ rubocop-performance (1.10.1)
58
+ rubocop (>= 0.90.0, < 2.0)
59
+ rubocop-ast (>= 0.4.0)
60
+ ruby-progressbar (1.11.0)
61
+ simplecov (0.21.2)
56
62
  docile (~> 1.1)
57
- json (>= 1.8, < 3)
58
- simplecov-html (~> 0.10.0)
59
- simplecov-html (0.10.2)
60
- timers (4.2.0)
61
- uuidtools (2.1.5)
63
+ simplecov-html (~> 0.11)
64
+ simplecov_json_formatter (~> 0.1)
65
+ simplecov-html (0.12.3)
66
+ simplecov_json_formatter (0.1.2)
67
+ standard (1.0.5)
68
+ rubocop (= 1.12.1)
69
+ rubocop-performance (= 1.10.1)
70
+ standardrb (1.0.0)
71
+ standard
72
+ timers (4.3.3)
73
+ unicode-display_width (2.0.0)
74
+ uuidtools (2.2.0)
62
75
 
63
76
  PLATFORMS
64
77
  ruby
78
+ x86_64-darwin-18
65
79
 
66
80
  DEPENDENCIES
67
- bundler (~> 1.17)
81
+ bundler (~> 2.1)
68
82
  eventhub-processor2!
69
- rake (~> 12.3)
70
- rspec (~> 3.8)
71
- simplecov (~> 0.16)
83
+ rake (~> 13.0)
84
+ rspec (~> 3.9)
85
+ simplecov (~> 0.21)
86
+ standardrb (~> 1.0)
72
87
 
73
88
  BUNDLED WITH
74
- 1.17.1
89
+ 2.2.2
data/README.md CHANGED
@@ -173,7 +173,19 @@ Processor2 symbolizes keys and sub-keys from configuration files automatically.
173
173
 
174
174
  ## Development
175
175
 
176
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
176
+ ```
177
+ # Get the source code
178
+ git clone https://github.com/thomis/eventhub-processor2.git
179
+
180
+ # Install dependencies
181
+ bundle
182
+
183
+ # Setup rabbitmq docker container with initial definitions. This can be run multiple times to get your container back into an initial state
184
+ bundle exec rake init
185
+
186
+ # Run all rspec tests
187
+ bundle exec rake
188
+ ```
177
189
 
178
190
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
179
191
 
data/Rakefile CHANGED
@@ -1,6 +1,15 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require "standard/rake"
3
4
 
4
- RSpec::Core::RakeTask.new(:spec)
5
+ RSpec::Core::RakeTask.new(:spec) do |t|
6
+ t.verbose = false
7
+ end
5
8
 
6
- task default: :spec
9
+ desc "Initialize or reset rabbitmq docker container (run before rspec)"
10
+ task :init do
11
+ sh "cd docker && ./reset"
12
+ puts "You may need to give rabbitmq container a bit time to startup properly..."
13
+ end
14
+
15
+ task default: [:spec, :standard]
data/docker/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM rabbitmq:3.7.7-management
1
+ FROM rabbitmq:3.8.14-management
2
2
 
3
3
  LABEL maintainer="thomas.steiner@ikey.ch"
4
4
 
@@ -1,5 +1,7 @@
1
1
  {
2
- "rabbit_version": "3.6.14",
2
+ "rabbitmq_version": "3.8.14",
3
+ "product_name": "RabbitMQ",
4
+ "product_version": "3.8.14",
3
5
  "users": [
4
6
  {
5
7
  "name": "guest",
@@ -51,6 +53,13 @@
51
53
  "durable": true,
52
54
  "auto_delete": false,
53
55
  "arguments": {}
56
+ },
57
+ {
58
+ "name": "processor2",
59
+ "vhost": "event_hub",
60
+ "durable": true,
61
+ "auto_delete": false,
62
+ "arguments": {}
54
63
  }
55
64
  ],
56
65
  "exchanges": [
@@ -80,6 +89,24 @@
80
89
  "auto_delete": false,
81
90
  "internal": false,
82
91
  "arguments": {}
92
+ },
93
+ {
94
+ "name": "an_exchange",
95
+ "vhost": "event_hub",
96
+ "type": "direct",
97
+ "durable": true,
98
+ "auto_delete": false,
99
+ "internal": false,
100
+ "arguments": {}
101
+ },
102
+ {
103
+ "name": "processor2",
104
+ "vhost": "event_hub",
105
+ "type": "direct",
106
+ "durable": true,
107
+ "auto_delete": false,
108
+ "internal": false,
109
+ "arguments": {}
83
110
  }
84
111
  ],
85
112
  "bindings": [
@@ -106,6 +133,22 @@
106
133
  "destination_type": "queue",
107
134
  "routing_key": "",
108
135
  "arguments": {}
136
+ },
137
+ {
138
+ "source": "an_exchange",
139
+ "vhost": "event_hub",
140
+ "destination": "example.outbound",
141
+ "destination_type": "queue",
142
+ "routing_key": "",
143
+ "arguments": {}
144
+ },
145
+ {
146
+ "source": "processor2",
147
+ "vhost": "event_hub",
148
+ "destination": "processor2",
149
+ "destination_type": "queue",
150
+ "routing_key": "",
151
+ "arguments": {}
109
152
  }
110
153
  ]
111
154
  }
@@ -4,7 +4,7 @@ services:
4
4
  rabbitmq:
5
5
  build: .
6
6
  container_name: eventhub.rabbitmq
7
- image: eventhub.rabbitmq:1.0
7
+ image: eventhub.rabbitmq:3.8.14
8
8
  ports:
9
9
  - "5672:5672"
10
10
  - "15672:15672"
data/docker/reset ADDED
@@ -0,0 +1,5 @@
1
+ # stopping, deleting an rebuilding rabbitmq docker container
2
+ docker-compose stop
3
+ docker rm eventhub.rabbitmq
4
+ docker rmi $(docker images 'eventhub.rabbitmq' -q)
5
+ docker-compose up -d
@@ -1,37 +1,38 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path("../lib", __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'eventhub/version'
3
+ require "eventhub/version"
4
4
 
5
- note = 'Next generation gem to build ruby based eventhub processor'
5
+ note = "Next generation gem to build ruby based eventhub processor"
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = 'eventhub-processor2'
9
- spec.version = EventHub::VERSION
10
- spec.authors = ['Steiner, Thomas']
11
- spec.email = ['thomas.steiner@ikey.ch']
8
+ spec.name = "eventhub-processor2"
9
+ spec.version = EventHub::VERSION
10
+ spec.authors = ["Steiner, Thomas"]
11
+ spec.email = ["thomas.steiner@ikey.ch"]
12
12
 
13
- spec.summary = note
14
- spec.description = note
15
- spec.homepage = 'https://github.com/thomis/eventhub-processor2'
16
- spec.license = 'MIT'
13
+ spec.summary = note
14
+ spec.description = note
15
+ spec.homepage = "https://github.com/thomis/eventhub-processor2"
16
+ spec.license = "MIT"
17
17
 
18
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
19
  f.match(%r{^(test|spec|features)/})
20
20
  end
21
- spec.bindir = 'exe'
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
- spec.require_paths = ['lib']
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
24
 
25
25
  # required by celluloid and bunny (-> amq-protocol)
26
26
  # spec.required_ruby_version = '~> 2.2.6'
27
27
 
28
- spec.add_dependency 'celluloid', '~> 0.17'
29
- spec.add_dependency 'bunny', '~> 2.12'
30
- spec.add_dependency 'eventhub-components', '~> 0.2'
31
- spec.add_dependency 'uuidtools', '~> 2.1'
28
+ spec.add_dependency "celluloid", "~> 0.18"
29
+ spec.add_dependency "bunny", "~> 2.15"
30
+ spec.add_dependency "eventhub-components", "~> 0.2"
31
+ spec.add_dependency "uuidtools", "~> 2.1"
32
32
 
33
- spec.add_development_dependency 'bundler', '~> 1.17'
34
- spec.add_development_dependency 'rake', '~> 12.3'
35
- spec.add_development_dependency 'rspec', '~> 3.8'
36
- spec.add_development_dependency 'simplecov', '~> 0.16'
33
+ spec.add_development_dependency "bundler", "~> 2.1"
34
+ spec.add_development_dependency "rake", "~> 13.0"
35
+ spec.add_development_dependency "rspec", "~> 3.9"
36
+ spec.add_development_dependency "simplecov", "~> 0.21"
37
+ spec.add_development_dependency "standardrb", "~> 1.0"
37
38
  end
data/example/crasher.rb CHANGED
@@ -1,17 +1,17 @@
1
- require 'eventhub/components'
2
- require_relative '../lib/eventhub/sleeper'
1
+ require "eventhub/components"
2
+ require_relative "../lib/eventhub/sleeper"
3
3
 
4
4
  RESTART_RANGES_IN_SECONDS = (30..600).to_a
5
- PROCESS_PATTERNS = ['router', 'receiver']
5
+ PROCESS_PATTERNS = ["router", "receiver"]
6
6
 
7
7
  # Module Crasher
8
8
  module Crasher
9
9
  def self.logger
10
10
  unless @logger
11
11
  @logger = ::EventHub::Components::MultiLogger.new
12
- @logger.add_device(Logger.new(STDOUT))
12
+ @logger.add_device(Logger.new($stdout))
13
13
  @logger.add_device(
14
- EventHub::Components::Logger.logstash('crasher', 'development')
14
+ EventHub::Components::Logger.logstash("crasher", "development")
15
15
  )
16
16
  end
17
17
  @logger
@@ -26,7 +26,7 @@ module Crasher
26
26
 
27
27
  def restart
28
28
  Crasher.logger.info "Sending Signal HUP to process [#{@id}/#{@name}]"
29
- Process.kill('HUP', @id)
29
+ Process.kill("HUP", @id)
30
30
  rescue Errno::ESRCH
31
31
  end
32
32
 
@@ -35,13 +35,13 @@ module Crasher
35
35
  PROCESS_PATTERNS.each do |name|
36
36
  data = `ps | grep #{name}.rb`
37
37
  data.lines[0..-2].each do |line|
38
- a = line.split(' ')
38
+ a = line.split(" ")
39
39
  next if a.size > 5
40
40
  processes << MyProcess.new(a[0].to_i, a[-1])
41
41
  end
42
42
  end
43
43
 
44
- Crasher.logger.info "Found ids: #{processes.map{ |pr| pr.id}.join(', ')}"
44
+ Crasher.logger.info "Found ids: #{processes.map { |pr| pr.id }.join(", ")}"
45
45
  processes
46
46
  end
47
47
  end
@@ -61,13 +61,12 @@ module Crasher
61
61
  end
62
62
  end
63
63
 
64
-
65
64
  class Application
66
65
  def initialize
67
66
  @sleeper = EventHub::Sleeper.new
68
67
  @run = true
69
68
 
70
- Signal.trap('INT') {
69
+ Signal.trap("INT") {
71
70
  @run = false
72
71
  @sleeper.stop
73
72
  }
@@ -75,8 +74,8 @@ module Crasher
75
74
 
76
75
  def pick_process
77
76
  processes = []
78
- processes << Docker.new('processor-rabbitmq')
79
- processes << Docker.new('processor-rabbitmq', 0)
77
+ processes << Docker.new("eventhub.rabbitmq")
78
+ processes << Docker.new("eventhub.rabbitmq", 0)
80
79
  processes << MyProcess.all
81
80
  processes.flatten.sample
82
81
  end
@@ -89,7 +88,7 @@ module Crasher
89
88
  @sleeper.start(to_sleep)
90
89
  next unless @run
91
90
  process = pick_process
92
- process.restart if process
91
+ process&.restart
93
92
  end
94
93
  Crasher.logger.info "Crasher has been stopped"
95
94
  end