rabbitek 0.4.0 → 0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1f7cc70de57fb560439fe5e93b30b76e419d8e00dcea7379c6b3fe4aa4a6325
4
- data.tar.gz: 1eb6bd702c62d2e9cd44f97211cfbe6769c58db9f032073bf0361a137d5c16e9
3
+ metadata.gz: 8c5f09ef286a1f37a026cf370fce7fb800b68da92abff95ee56f1ef5408fd6e3
4
+ data.tar.gz: da008b7f6a410ee65d63b879229df6418455ef688d3b8b7a0e4deb1ec685b985
5
5
  SHA512:
6
- metadata.gz: 398811e481a4b197ddaea89a52448d76e158576156aacffb5c3801d0b3122bfb3df1770e15c348500fd5fe59a172b3bdb3d8f0c52e4642a9306a7d983a8c616f
7
- data.tar.gz: fcc347a951e4530f723e8d754a58b111b7463cc175a3944249296db049b070898b1b44e509633c7af2c8d633c6fa2fb8c45908c3e09e6fa87c677ef327db8c5c
6
+ metadata.gz: 8c32c7beb1a29a53a25b8a3e936126c6c54b070d5a62b81dd07e0103d07a5e541669083fbd7a28d9816cdcf7cff939d988b95d47690f3a57c00b00308b3c07c6
7
+ data.tar.gz: 0e32bceb540529fd08e6647f8e5dd71bd251f26f147c3c5e89fc5ec71c3f4ec2490fe0172e9fe98719d34c3c5b6724809461c42c80771949c6dbd41198ab847d
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rabbitek (0.4.0)
4
+ rabbitek (0.8.1)
5
5
  activesupport (> 3.0)
6
6
  bunny (~> 2.11.0)
7
- oj (~> 3.6)
7
+ oj (> 2.0.0)
8
8
  opentracing (~> 0.4)
9
9
  slop (~> 4.0)
10
- yabeda
10
+ yabeda (>= 0.6.0)
11
11
 
12
12
  GEM
13
13
  remote: https://rubygems.org/
@@ -53,14 +53,15 @@ GEM
53
53
  i18n (>= 0.7, < 2)
54
54
  minitest (~> 5.1)
55
55
  tzinfo (~> 1.1)
56
- amq-protocol (2.3.0)
56
+ amq-protocol (2.3.2)
57
57
  arel (9.0.0)
58
58
  ast (2.4.0)
59
+ bigdecimal (2.0.0)
59
60
  builder (3.2.4)
60
61
  bunny (2.11.0)
61
62
  amq-protocol (~> 2.3.0)
62
63
  coderay (1.1.2)
63
- concurrent-ruby (1.1.5)
64
+ concurrent-ruby (1.1.6)
64
65
  crass (1.0.6)
65
66
  diff-lcs (1.3)
66
67
  dry-initializer (3.0.3)
@@ -85,7 +86,8 @@ GEM
85
86
  nio4r (2.5.2)
86
87
  nokogiri (1.10.7)
87
88
  mini_portile2 (~> 2.4.0)
88
- oj (3.10.0)
89
+ oj (3.10.9)
90
+ bigdecimal (~> 2.0)
89
91
  opentracing (0.5.0)
90
92
  parallel (1.12.1)
91
93
  parser (2.5.1.2)
@@ -145,7 +147,7 @@ GEM
145
147
  ruby-progressbar (~> 1.7)
146
148
  unicode-display_width (~> 1.0, >= 1.0.1)
147
149
  ruby-progressbar (1.10.0)
148
- slop (4.7.0)
150
+ slop (4.8.2)
149
151
  sprockets (4.0.0)
150
152
  concurrent-ruby (~> 1.0)
151
153
  rack (> 1, < 3)
@@ -161,7 +163,7 @@ GEM
161
163
  websocket-driver (0.7.1)
162
164
  websocket-extensions (>= 0.1.0)
163
165
  websocket-extensions (0.1.4)
164
- yabeda (0.3.0)
166
+ yabeda (0.7.0)
165
167
  concurrent-ruby
166
168
  dry-initializer
167
169
 
@@ -178,4 +180,4 @@ DEPENDENCIES
178
180
  rubocop (~> 0.58.0)
179
181
 
180
182
  BUNDLED WITH
181
- 2.0.2
183
+ 2.1.4
@@ -58,11 +58,12 @@ end
58
58
 
59
59
  Yabeda.configure do
60
60
  group :rabbitek do
61
- counter :processed_messages_count, comment: 'Total number of all messages'
62
- counter :errored_messages_count, comment: 'Total number of errored messages'
61
+ counter :processed_messages_count, comment: 'Total number of all messages', tags: %i[consumer]
62
+ counter :errored_messages_count, comment: 'Total number of errored messages', tags: %i[consumer]
63
63
  histogram :processed_messages_runtime do
64
64
  comment 'How long it takes to process message'
65
65
  unit :seconds
66
+ tags %i[consumer]
66
67
  buckets [0.1, 0.5, 1, 5, 10, 30, 60]
67
68
  end
68
69
  end
@@ -14,9 +14,12 @@ module Rabbitek
14
14
  class CLI
15
15
  include ::Rabbitek::Loggable
16
16
 
17
- def run
17
+ def run # rubocop:disable Metrics/AbcSize
18
18
  opts
19
19
  require_application
20
+
21
+ Yabeda.configure! unless Yabeda.already_configured?
22
+
20
23
  map_consumer_workers!
21
24
 
22
25
  start_log
@@ -6,7 +6,7 @@ module Rabbitek
6
6
  class Batcher
7
7
  def initialize(consumer)
8
8
  @consumer = consumer
9
- @batch_size = consumer.batch_size
9
+ @batch_size = consumer.opts[:batch][:of]
10
10
  @batch = []
11
11
  end
12
12
 
@@ -52,16 +52,16 @@ module Rabbitek
52
52
  Message.new(delivery_info: delivery_info, properties: properties, payload: payload)
53
53
  end
54
54
 
55
- def batch_size
56
- self.class.batch
55
+ def opts
56
+ self.class.opts
57
57
  end
58
58
 
59
59
  module ClassMethods # rubocop:disable Style/Documentation
60
- attr_accessor :rabbit_options_hash, :batch
60
+ attr_accessor :rabbit_options_hash, :opts
61
61
 
62
62
  def rabbit_options(opts)
63
63
  self.rabbit_options_hash = default_rabbit_options(opts).with_indifferent_access.merge(opts)
64
- self.batch = opts[:batch]
64
+ self.opts = opts
65
65
  end
66
66
 
67
67
  def perform_async(payload, opts: {}, channel: nil)
@@ -13,7 +13,7 @@ module Rabbitek
13
13
  def call(consumer, message)
14
14
  super
15
15
  rescue StandardError
16
- retry_message(consumer, message) unless consumer.batch_size
16
+ retry_message(consumer, message) unless consumer.opts[:batch]
17
17
  raise
18
18
  end
19
19
 
@@ -33,18 +33,18 @@ module Rabbitek
33
33
  def_delegators :starter, :channel, :work_queue, :retry_or_delayed_queue, :retry_or_delayed_exchange
34
34
 
35
35
  def run_job(modified_consumer, message)
36
- if modified_consumer.class.batch
36
+ if modified_consumer.opts[:batch]
37
37
  run_job_batched(modified_consumer, message)
38
38
  else
39
39
  modified_consumer.perform(message)
40
- modified_consumer.ack!(message.delivery_info)
40
+ modified_consumer.ack!(message.delivery_info) unless modified_consumer.opts[:manual_ack]
41
41
  end
42
42
  end
43
43
 
44
44
  def run_job_batched(modified_consumer, message)
45
45
  Batcher.new(modified_consumer).perform(message) do |batch|
46
46
  modified_consumer.perform(batch)
47
- modified_consumer.ack!(batch.last.delivery_info, true)
47
+ modified_consumer.ack!(batch.last.delivery_info, true) unless modified_consumer.opts[:manual_ack]
48
48
  end
49
49
  end
50
50
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rabbitek
4
- VERSION = '0.4.0'
4
+ VERSION = '0.8.1'
5
5
  end
@@ -31,10 +31,10 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.add_dependency 'activesupport', '> 3.0'
33
33
  spec.add_dependency 'bunny', '~> 2.11.0'
34
- spec.add_dependency 'oj', '~> 3.6'
34
+ spec.add_dependency 'oj', '> 2.0.0'
35
35
  spec.add_dependency 'opentracing', '~> 0.4'
36
36
  spec.add_dependency 'slop', '~> 4.0'
37
- spec.add_dependency 'yabeda'
37
+ spec.add_dependency 'yabeda', '>= 0.6.0'
38
38
 
39
39
  spec.add_development_dependency 'bundler', '~> 2.0'
40
40
  spec.add_development_dependency 'pry'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbitek
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boostcom
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-16 00:00:00.000000000 Z
11
+ date: 2020-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: oj
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.6'
47
+ version: 2.0.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.6'
54
+ version: 2.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: opentracing
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 0.6.0
90
90
  type: :runtime
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: '0'
96
+ version: 0.6.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: bundler
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -236,7 +236,7 @@ metadata:
236
236
  source_code_uri: https://github.com/Boostcom/rabbitek
237
237
  changelog_uri: https://github.com/Boostcom/rabbitek/blob/master/CHANGELOG.md
238
238
  bug_tracker_uri: https://github.com/Boostcom/rabbitek/issues
239
- post_install_message:
239
+ post_install_message:
240
240
  rdoc_options: []
241
241
  require_paths:
242
242
  - lib
@@ -251,8 +251,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
251
  - !ruby/object:Gem::Version
252
252
  version: '0'
253
253
  requirements: []
254
- rubygems_version: 3.0.3
255
- signing_key:
254
+ rubygems_version: 3.1.2
255
+ signing_key:
256
256
  specification_version: 4
257
257
  summary: High performance background job processing
258
258
  test_files: []