eventhub-processor2 1.4.0 → 1.9.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: 7b692a9ccf6bb27c587b52df66c2ccc5485756ff
4
- data.tar.gz: 3db7ba2a63141de21449c0c5abc125bb7e85cff6
2
+ SHA256:
3
+ metadata.gz: c2802cc49773eefcd1c4ac043ad25c07a59576eae96f1a657556741e20da1815
4
+ data.tar.gz: 84f36939159674c30169766b44e427fdee7a03cbdba0f3d4f356040bb5c2ed41
5
5
  SHA512:
6
- metadata.gz: 6b91eccfcf2383a7f74073a72da4b6b63977164e085b9f165ee691396b9972157b0c840a6f40075b949c41876fe36a01fe6d2c74a992eb8715048d15ec941abb
7
- data.tar.gz: aa65ef67b6dd96aec7e471f46f91b9b08ca12658becf8ff4436f284e9f3413c893ac250e2719a3d6e2f5b955b2a5567b320c0dc01540eab3f846baac921319d0
6
+ metadata.gz: 71c2532c9d70ea9d913778f12435f36d8d4aa1185b7586e6ad41803aa2f5f4182c720edaa17e32e77889c9e46ab4b4147fbaae78ec7ecfab31729208e4f182ed
7
+ data.tar.gz: 57e0722d7267a3dd6356422ac7f069390dcfce6fe06f7d40eac1debba3efb44418d1c3a5291806db7d4bf0272e98a54a5dc5a479ab1c621ee8afdf33e3f09241
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,35 @@
1
1
  # Changelog of EventHub::Processor2
2
2
 
3
+ ## 1.9.0 / 2021-02-26
4
+
5
+ * Updated gem dependencies
6
+ * Appply ruby style guides
7
+ * Reduce log noice
8
+
9
+ ## 1.8.0 / 2020-05-05
10
+
11
+ * Increase watchdog cycle time to 60s
12
+ * Upgrade gem and gem dev dependencies
13
+ * Upgrade travis ruby version to test
14
+
15
+ ## 1.7.0 / 2020-02-28
16
+
17
+ * Upgrade dependencies: bundler 2.1, rake 13.0, rspec 3.9, simplecov 0.18
18
+ * status_message always as string for general exception handling
19
+ * fix rspec tests
20
+
21
+ ## 1.6.0 / 2019-02-20
22
+
23
+ * Upgrade dependencies: bunny 2.14, bundler 2.0
24
+
25
+ ## 1.5.0 / 2018-12-20
26
+
27
+ * Upgrade dependencies: rspec 3.8, bunny 2.12, bundler 1.17, simplecov 0.16
28
+
29
+ ## 1.4.1 / 2018-02-27
30
+
31
+ * Upgrade to eventhub-components 0.2.2
32
+
3
33
  ## 1.4.0 / 2018-02-27
4
34
 
5
35
  * Upgrade to bunny 2.9.2
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,76 +1,88 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eventhub-processor2 (1.4.0)
5
- bunny (~> 2.9)
6
- celluloid (~> 0.17)
4
+ eventhub-processor2 (1.9.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.9.2)
15
- amq-protocol (~> 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.1.5)
35
- eventhub-components (0.2.0)
36
- logstash-logger (~> 0.25)
37
- hitimes (1.2.6)
38
- json (2.1.0)
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)
21
+ eventhub-components (0.2.2)
22
+ logstash-logger (~> 0.26)
39
23
  logstash-event (1.2.02)
40
24
  logstash-logger (0.26.1)
41
25
  logstash-event (~> 1.2)
42
- rake (12.3.0)
43
- rspec (3.7.0)
44
- rspec-core (~> 3.7.0)
45
- rspec-expectations (~> 3.7.0)
46
- rspec-mocks (~> 3.7.0)
47
- rspec-core (3.7.0)
48
- rspec-support (~> 3.7.0)
49
- rspec-expectations (3.7.0)
26
+ parallel (1.20.1)
27
+ parser (3.0.0.0)
28
+ ast (~> 2.4.1)
29
+ rainbow (3.0.0)
30
+ rake (13.0.3)
31
+ regexp_parser (2.0.3)
32
+ rexml (3.2.4)
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)
50
40
  diff-lcs (>= 1.2.0, < 2.0)
51
- rspec-support (~> 3.7.0)
52
- rspec-mocks (3.7.0)
41
+ rspec-support (~> 3.10.0)
42
+ rspec-mocks (3.10.2)
53
43
  diff-lcs (>= 1.2.0, < 2.0)
54
- rspec-support (~> 3.7.0)
55
- rspec-support (3.7.0)
56
- simplecov (0.15.1)
57
- docile (~> 1.1.0)
58
- json (>= 1.8, < 3)
59
- simplecov-html (~> 0.10.0)
60
- simplecov-html (0.10.2)
61
- timers (4.1.2)
62
- hitimes
63
- uuidtools (2.1.5)
44
+ rspec-support (~> 3.10.0)
45
+ rspec-support (3.10.2)
46
+ rubocop (1.10.0)
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.9.2)
58
+ rubocop (>= 0.90.0, < 2.0)
59
+ rubocop-ast (>= 0.4.0)
60
+ ruby-progressbar (1.11.0)
61
+ simplecov (0.21.2)
62
+ docile (~> 1.1)
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 (0.13.0)
68
+ rubocop (= 1.10.0)
69
+ rubocop-performance (= 1.9.2)
70
+ standardrb (1.0.0)
71
+ standard
72
+ timers (4.3.3)
73
+ unicode-display_width (2.0.0)
74
+ uuidtools (2.2.0)
64
75
 
65
76
  PLATFORMS
66
77
  ruby
67
78
 
68
79
  DEPENDENCIES
69
- bundler (~> 1.16)
80
+ bundler (~> 2.1)
70
81
  eventhub-processor2!
71
- rake (~> 12.3)
72
- rspec (~> 3.7)
73
- simplecov (~> 0.15)
82
+ rake (~> 13.0)
83
+ rspec (~> 3.9)
84
+ simplecov (~> 0.21)
85
+ standardrb (~> 1.0)
74
86
 
75
87
  BUNDLED WITH
76
- 1.16.1
88
+ 2.1.4
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Dependency Status](https://gemnasium.com/badges/github.com/thomis/eventhub-processor2.svg)](https://gemnasium.com/github.com/thomis/eventhub-processor2)
1
+ [![Gem Version](https://badge.fury.io/rb/eventhub-processor2.svg)](https://badge.fury.io/rb/eventhub-processor2)
2
2
  [![Maintainability](https://api.codeclimate.com/v1/badges/9112358562f0614e0e02/maintainability)](https://codeclimate.com/github/thomis/eventhub-processor2/maintainability)
3
3
  [![Test Coverage](https://api.codeclimate.com/v1/badges/9112358562f0614e0e02/test_coverage)](https://codeclimate.com/github/thomis/eventhub-processor2/test_coverage)
4
4
  [![Build Status](https://travis-ci.org/thomis/eventhub-processor2.svg?branch=master)](https://travis-ci.org/thomis/eventhub-processor2)
data/Rakefile CHANGED
@@ -1,6 +1,9 @@
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
+ task default: [:spec, :standard]
data/docker/Dockerfile CHANGED
@@ -1,6 +1,8 @@
1
- FROM rabbitmq:3.7.3-management
1
+ FROM rabbitmq:3.8.12-management
2
+
3
+ LABEL maintainer="thomas.steiner@ikey.ch"
4
+
2
5
  ADD definitions.json /etc/rabbitmq/
3
6
  ADD rabbitmq.config /etc/rabbitmq/
4
7
  RUN chown rabbitmq:rabbitmq /etc/rabbitmq/rabbitmq.config /etc/rabbitmq/definitions.json
5
-
6
- EXPOSE 5672 15672
8
+ RUN rabbitmq-plugins enable rabbitmq_web_stomp
data/docker/README.md CHANGED
@@ -5,8 +5,8 @@ Please follow these steps to build and run a docker container with a predefined
5
5
 
6
6
  * Have latest docker community edition installed (https://www.docker.com)
7
7
  * cd into the docker folder
8
- * docker build -t processor-rabbitmq .
9
- * docker run -d -p 5672:5672 -p 15672:15672 --name processor-rabbitmq processor-rabbitmq
8
+ * docker-compose up --no-start
9
+ * docker-compose start
10
10
 
11
11
  Is the docker container running fine?
12
12
  Go to http://localhost:15672 and login to RabbitMQ Management Console with guest/guest
@@ -80,6 +80,15 @@
80
80
  "auto_delete": false,
81
81
  "internal": false,
82
82
  "arguments": {}
83
+ },
84
+ {
85
+ "name": "an_exchange",
86
+ "vhost": "event_hub",
87
+ "type": "direct",
88
+ "durable": true,
89
+ "auto_delete": false,
90
+ "internal": false,
91
+ "arguments": {}
83
92
  }
84
93
  ],
85
94
  "bindings": [
@@ -106,6 +115,14 @@
106
115
  "destination_type": "queue",
107
116
  "routing_key": "",
108
117
  "arguments": {}
118
+ },
119
+ {
120
+ "source": "an_exchange",
121
+ "vhost": "event_hub",
122
+ "destination": "example.outbound",
123
+ "destination_type": "queue",
124
+ "routing_key": "",
125
+ "arguments": {}
109
126
  }
110
127
  ]
111
128
  }
@@ -0,0 +1,11 @@
1
+ version: '3.3'
2
+
3
+ services:
4
+ rabbitmq:
5
+ build: .
6
+ container_name: eventhub.rabbitmq
7
+ image: eventhub.rabbitmq:3.8.12
8
+ ports:
9
+ - "5672:5672"
10
+ - "15672:15672"
11
+ - "15674:15674"
@@ -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.9'
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.16'
34
- spec.add_development_dependency 'rake', '~> 12.3'
35
- spec.add_development_dependency 'rspec', '~> 3.7'
36
- spec.add_development_dependency 'simplecov', '~> 0.15'
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