ears 0.18.0 → 0.19.0

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: 01c681e58c7beb764a0f2c918d5302bd2c1dfe9ef6c07781c53b7acdb1c1b4a3
4
- data.tar.gz: 1b54b872326ae3e485ff19a0db89d826475124ce940fbab036e701bb18da26be
3
+ metadata.gz: ffe84e09754e5329b3e82b1add44fb3222b2ac2e36c1955ad54d6ea90505df8d
4
+ data.tar.gz: 2545f546c91cdc7ba3edd73e3035bcdc3253433d7dcf9d21ab7a6b1143c8722f
5
5
  SHA512:
6
- metadata.gz: c30bdf84da064e3a80cee0b9ae33aa788fe4ccf4facb1338af8a5c35563058a413141d1f8b3fe6510bba516e7c33da6c5ca6c0f1cdd2ec39307afe89c8df32a7
7
- data.tar.gz: 7c20df1ee7fe9c483c1a9e532b74e0ca767d2818981001ef26b2b10cd49f4d1022594f4b99a4c4ba7653eb7ca0d00e38300b5400b9ba141f37cf76697b9af297
6
+ metadata.gz: 24ed423d5b49a22bbab254ebd8e46322391f9d427fa0455dc039dd50fa7eb677222cef93561f11bde207fa9832c756d4050397a0dcfbb4afcb5e103fd1c82262
7
+ data.tar.gz: ffc77c61d3822b19e3e135a96983fcba0a0d61ff50b08c7a57a6e03bd5051498ac4481777e8fcccc90fc1152f4d0dc69248089e82f9ce15945be25aefd07acb9
data/.rubocop.yml CHANGED
@@ -1,3 +1,5 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
1
3
  inherit_mode:
2
4
  merge:
3
5
  - Exclude
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,17 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2025-03-10 15:51:28 UTC using RuboCop version 1.72.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: CountComments, CountAsOne.
11
+ Metrics/ClassLength:
12
+ Max: 104
13
+
14
+ # Offense count: 1
15
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
16
+ Metrics/MethodLength:
17
+ Max: 15
data/.tool-versions CHANGED
@@ -1,2 +1,2 @@
1
1
  ruby 3.1.6
2
- nodejs 23.6.0
2
+ nodejs 23.8.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.19.0 (2025-03-10)
4
+
5
+ - Enhance Consumer#configure method and Ears.setup_consumers to accept `prefetch` option, which will be passed to Ears::Setup.
6
+
3
7
  ## 0.18.0 (2025-01-20)
4
8
 
5
9
  - Enhance Consumer#configure method to accept custom queue arguments.
data/Gemfile CHANGED
@@ -3,12 +3,12 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :test do
6
- gem 'prettier', require: false
7
6
  gem 'rake'
8
7
  gem 'rspec'
9
8
  gem 'rubocop', require: false
10
9
  gem 'rubocop-rake', require: false
11
10
  gem 'rubocop-rspec', require: false
12
11
  gem 'simplecov'
12
+ gem 'syntax_tree', require: false
13
13
  gem 'yard', require: false
14
14
  end
data/Gemfile.lock CHANGED
@@ -1,49 +1,39 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ears (0.18.0)
4
+ ears (0.19.0)
5
5
  bunny (>= 2.22.0)
6
6
  multi_json
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- amq-protocol (2.3.2)
11
+ amq-protocol (2.3.3)
12
12
  ast (2.4.2)
13
13
  bunny (2.23.0)
14
14
  amq-protocol (~> 2.3, >= 2.3.1)
15
15
  sorted_set (~> 1, >= 1.0.2)
16
- diff-lcs (1.5.1)
16
+ diff-lcs (1.6.0)
17
17
  docile (1.4.1)
18
- haml (6.3.0)
19
- temple (>= 0.8.2)
20
- thor
21
- tilt
22
- json (2.9.1)
23
- language_server-protocol (3.17.0.3)
24
- logger (1.6.5)
18
+ json (2.10.1)
19
+ language_server-protocol (3.17.0.4)
20
+ lint_roller (1.1.0)
25
21
  multi_json (1.15.0)
26
22
  parallel (1.26.3)
27
- parser (3.3.6.0)
23
+ parser (3.3.7.1)
28
24
  ast (~> 2.4.1)
29
25
  racc
30
- prettier (4.0.4)
31
- syntax_tree (>= 4.0.1)
32
- syntax_tree-haml (>= 2.0.0)
33
- syntax_tree-rbs (>= 0.2.0)
34
26
  prettier_print (1.2.1)
35
27
  racc (1.8.1)
36
28
  rainbow (3.1.1)
37
29
  rake (13.2.1)
38
- rbs (3.6.1)
39
- logger
40
30
  rbtree (0.4.6)
41
31
  regexp_parser (2.10.0)
42
32
  rspec (3.13.0)
43
33
  rspec-core (~> 3.13.0)
44
34
  rspec-expectations (~> 3.13.0)
45
35
  rspec-mocks (~> 3.13.0)
46
- rspec-core (3.13.2)
36
+ rspec-core (3.13.3)
47
37
  rspec-support (~> 3.13.0)
48
38
  rspec-expectations (3.13.3)
49
39
  diff-lcs (>= 1.2.0, < 2.0)
@@ -52,22 +42,25 @@ GEM
52
42
  diff-lcs (>= 1.2.0, < 2.0)
53
43
  rspec-support (~> 3.13.0)
54
44
  rspec-support (3.13.2)
55
- rubocop (1.70.0)
45
+ rubocop (1.72.2)
56
46
  json (~> 2.3)
57
- language_server-protocol (>= 3.17.0)
47
+ language_server-protocol (~> 3.17.0.2)
48
+ lint_roller (~> 1.1.0)
58
49
  parallel (~> 1.10)
59
50
  parser (>= 3.3.0.2)
60
51
  rainbow (>= 2.2.2, < 4.0)
61
52
  regexp_parser (>= 2.9.3, < 3.0)
62
- rubocop-ast (>= 1.36.2, < 2.0)
53
+ rubocop-ast (>= 1.38.0, < 2.0)
63
54
  ruby-progressbar (~> 1.7)
64
55
  unicode-display_width (>= 2.4.0, < 4.0)
65
- rubocop-ast (1.37.0)
56
+ rubocop-ast (1.38.0)
66
57
  parser (>= 3.3.1.0)
67
- rubocop-rake (0.6.0)
68
- rubocop (~> 1.0)
69
- rubocop-rspec (3.3.0)
70
- rubocop (~> 1.61)
58
+ rubocop-rake (0.7.1)
59
+ lint_roller (~> 1.1)
60
+ rubocop (>= 1.72.1)
61
+ rubocop-rspec (3.5.0)
62
+ lint_roller (~> 1.1)
63
+ rubocop (~> 1.72, >= 1.72.1)
71
64
  ruby-progressbar (1.13.0)
72
65
  set (1.1.1)
73
66
  simplecov (0.22.0)
@@ -81,17 +74,6 @@ GEM
81
74
  set (~> 1.0)
82
75
  syntax_tree (6.2.0)
83
76
  prettier_print (>= 1.2.0)
84
- syntax_tree-haml (4.0.3)
85
- haml (>= 5.2)
86
- prettier_print (>= 1.2.1)
87
- syntax_tree (>= 6.0.0)
88
- syntax_tree-rbs (1.0.0)
89
- prettier_print
90
- rbs
91
- syntax_tree (>= 2.0.1)
92
- temple (0.10.3)
93
- thor (1.3.2)
94
- tilt (2.6.0)
95
77
  unicode-display_width (3.1.4)
96
78
  unicode-emoji (~> 4.0, >= 4.0.4)
97
79
  unicode-emoji (4.0.4)
@@ -109,14 +91,53 @@ PLATFORMS
109
91
 
110
92
  DEPENDENCIES
111
93
  ears!
112
- prettier
113
94
  rake
114
95
  rspec
115
96
  rubocop
116
97
  rubocop-rake
117
98
  rubocop-rspec
118
99
  simplecov
100
+ syntax_tree
119
101
  yard
120
102
 
103
+ CHECKSUMS
104
+ amq-protocol (2.3.3) sha256=85b42738290913a35dcc487a2ca0dd260a4150b40ed1954c9c1932df466abc1f
105
+ ast (2.4.2) sha256=1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12
106
+ bunny (2.23.0) sha256=b721d18b077d111ea08eeb1934a4d5f3005ca571853c05474f31d96f7b517ada
107
+ diff-lcs (1.6.0) sha256=a1e7f7b272962f8fc769358ad00001b87cdcf32ba349d6c70c6b544613d2da2e
108
+ docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
109
+ ears (0.19.0)
110
+ json (2.10.1) sha256=ddc88ad91a1baf3f0038c174f253af3b086d30dc74db17ca4259bbde982f94dc
111
+ language_server-protocol (3.17.0.4) sha256=c484626478664fd13482d8180947c50a8590484b1258b99b7aedb3b69df89669
112
+ lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
113
+ multi_json (1.15.0) sha256=1fd04138b6e4a90017e8d1b804c039031399866ff3fbabb7822aea367c78615d
114
+ parallel (1.26.3) sha256=d86babb7a2b814be9f4b81587bf0b6ce2da7d45969fab24d8ae4bf2bb4d4c7ef
115
+ parser (3.3.7.1) sha256=7dbe61618025519024ac72402a6677ead02099587a5538e84371b76659e6aca1
116
+ prettier_print (1.2.1) sha256=a72838b5f23facff21f90a5423cdcdda19e4271092b41f4ea7f50b83929e6ff9
117
+ racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
118
+ rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
119
+ rake (13.2.1) sha256=46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d
120
+ rbtree (0.4.6) sha256=14eea4469b24fd2472542e5f3eb105d6344c8ccf36f0b56d55fdcfeb4e0f10fc
121
+ regexp_parser (2.10.0) sha256=cb6f0ddde88772cd64bff1dbbf68df66d376043fe2e66a9ef77fcb1b0c548c61
122
+ rspec (3.13.0) sha256=d490914ac1d5a5a64a0e1400c1d54ddd2a501324d703b8cfe83f458337bab993
123
+ rspec-core (3.13.3) sha256=25136507f4f9cf2e8977a2851e64e438b4331646054e345998714108745cdfe4
124
+ rspec-expectations (3.13.3) sha256=0e6b5af59b900147698ea0ff80456c4f2e69cac4394fbd392fbd1ca561f66c58
125
+ rspec-mocks (3.13.2) sha256=2327335def0e1665325a9b617e3af9ae20272741d80ac550336309a7c59abdef
126
+ rspec-support (3.13.2) sha256=cea3a2463fd9b84b9dcc9685efd80ea701aa8f7b3decb3b3ce795ed67737dbec
127
+ rubocop (1.72.2) sha256=0259a32d89fee60882bf4c4d8847e696357719c9db4971839da742bf053ae96b
128
+ rubocop-ast (1.38.0) sha256=4fdf6792fe443a9a18acb12dbc8225d0d64cd1654e41fedb30e79c18edbb26ae
129
+ rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d
130
+ rubocop-rspec (3.5.0) sha256=710c942fe1af884ba8eea75cbb8bdbb051929a2208880a6fc2e2dce1eed5304c
131
+ ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
132
+ set (1.1.1) sha256=6c7ac6c06d5907216395a4d5dae3ffe52ca5ee8a372befe6d4dea794383f98f0
133
+ simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
134
+ simplecov-html (0.13.1) sha256=5dab0b7ee612e60e9887ad57693832fdf4695b4c0c859eaea5f95c18791ef10b
135
+ simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
136
+ sorted_set (1.0.3) sha256=4f2b8bee6e8c59cbd296228c0f1f81679357177a8b6859dcc2a99e86cce6372f
137
+ syntax_tree (6.2.0) sha256=a50a01c246601af3c258edbb6b12e44373d17966ab3bebd1f7224b3b994a343d
138
+ unicode-display_width (3.1.4) sha256=8caf2af1c0f2f07ec89ef9e18c7d88c2790e217c482bfc78aaa65eadd5415ac1
139
+ unicode-emoji (4.0.4) sha256=2c2c4ef7f353e5809497126285a50b23056cc6e61b64433764a35eff6c36532a
140
+ yard (0.9.37) sha256=a6e910399e78e613f80ba9add9ba7c394b1a935f083cccbef82903a3d2a26992
141
+
121
142
  BUNDLED WITH
122
- 2.6.3
143
+ 2.6.5
data/lib/ears/consumer.rb CHANGED
@@ -42,6 +42,7 @@ module Ears
42
42
  # @option opts [Symbol] :exchange_type (:topic) The type of exchange to use.
43
43
  # @option opts [Integer] :threads (1) The number of threads to use for this consumer.
44
44
  # @option opts [Hash] :arguments (nil) Additional arguments for the queue.
45
+ # @option opts [Integer] :prefetch (1) The number of messages to prefetch.
45
46
  def self.configure(opts = {})
46
47
  self.queue = opts.fetch(:queue)
47
48
  self.exchange = opts.fetch(:exchange)
@@ -50,6 +51,7 @@ module Ears
50
51
  self.durable_exchange = opts.fetch(:durable_exchange, true)
51
52
  self.exchange_type = opts.fetch(:exchange_type, :topic)
52
53
  self.threads = opts.fetch(:threads, 1)
54
+ self.prefetch = opts.fetch(:prefetch, 1)
53
55
  end
54
56
 
55
57
  # The method that is called when a message from the queue is received.
@@ -134,7 +136,8 @@ module Ears
134
136
  :queue_options,
135
137
  :durable_exchange,
136
138
  :exchange_type,
137
- :threads
139
+ :threads,
140
+ :prefetch
138
141
 
139
142
  private
140
143
 
@@ -154,7 +157,8 @@ module Ears
154
157
  :queue_options,
155
158
  :durable_exchange,
156
159
  :exchange_type,
157
- :threads
160
+ :threads,
161
+ :prefetch
158
162
  end
159
163
  end
160
164
  end
data/lib/ears/setup.rb CHANGED
@@ -77,7 +77,12 @@ module Ears
77
77
  configured_queue =
78
78
  queue(consumer_class.queue, consumer_class.queue_options)
79
79
  bind_queue_to_routing_keys(consumer_class, exchange, configured_queue)
80
- consumer(configured_queue, consumer_class, consumer_class.threads)
80
+ consumer(
81
+ configured_queue,
82
+ consumer_class,
83
+ consumer_class.threads,
84
+ { prefetch: consumer_class.prefetch },
85
+ )
81
86
  end
82
87
 
83
88
  def bind_queue_to_routing_keys(consumer_class, exchange, configured_queue)
data/lib/ears/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ears
2
- VERSION = '0.18.0'
2
+ VERSION = '0.19.0'
3
3
  end
data/package-lock.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "devDependencies": {
9
9
  "@invisionag/prettier-config": "^2.1.3",
10
10
  "@prettier/plugin-ruby": "^4.0.4",
11
- "prettier": "^3.4.2"
11
+ "prettier": "^3.5.2"
12
12
  }
13
13
  },
14
14
  "node_modules/@invisionag/prettier-config": {
@@ -30,9 +30,9 @@
30
30
  }
31
31
  },
32
32
  "node_modules/prettier": {
33
- "version": "3.4.2",
34
- "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz",
35
- "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==",
33
+ "version": "3.5.2",
34
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.2.tgz",
35
+ "integrity": "sha512-lc6npv5PH7hVqozBR7lkBNOGXV9vMwROAPlumdBkX0wTbbzPu/U1hk5yL8p2pt4Xoc+2mkT8t/sow2YrV/M5qg==",
36
36
  "dev": true,
37
37
  "license": "MIT",
38
38
  "bin": {
@@ -62,9 +62,9 @@
62
62
  "requires": {}
63
63
  },
64
64
  "prettier": {
65
- "version": "3.4.2",
66
- "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz",
67
- "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==",
65
+ "version": "3.5.2",
66
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.2.tgz",
67
+ "integrity": "sha512-lc6npv5PH7hVqozBR7lkBNOGXV9vMwROAPlumdBkX0wTbbzPu/U1hk5yL8p2pt4Xoc+2mkT8t/sow2YrV/M5qg==",
68
68
  "dev": true
69
69
  }
70
70
  }
data/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "devDependencies": {
10
10
  "@invisionag/prettier-config": "^2.1.3",
11
11
  "@prettier/plugin-ruby": "^4.0.4",
12
- "prettier": "^3.4.2"
12
+ "prettier": "^3.5.2"
13
13
  },
14
14
  "prettier": "@invisionag/prettier-config/ruby"
15
15
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ears
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - InVision AG
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-23 00:00:00.000000000 Z
11
+ date: 2025-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny
@@ -52,6 +52,7 @@ files:
52
52
  - ".gitignore"
53
53
  - ".rspec"
54
54
  - ".rubocop.yml"
55
+ - ".rubocop_todo.yml"
55
56
  - ".tool-versions"
56
57
  - ".yardopts"
57
58
  - CHANGELOG.md