ears 0.25.0 → 0.26.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 +4 -4
- data/.github/dependabot.yml +16 -6
- data/.github/workflows/build.yml +1 -1
- data/.github/workflows/dependency-review.yml +1 -1
- data/.rubocop.yml +1 -1
- data/.tool-versions +2 -2
- data/CHANGELOG.md +5 -0
- data/CLAUDE.md +80 -0
- data/Gemfile.lock +20 -19
- data/ears.gemspec +2 -2
- data/lib/ears/version.rb +1 -1
- data/package-lock.json +7 -7
- data/package.json +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 565ce26dac7f697372fa56fedccaffd5fe052a63a0d0a8dfe3fbc18dc47e4cc1
|
|
4
|
+
data.tar.gz: 6f7614f9e37a7ef7f345dff81afd1b3cf000cd8932754dc334d8bc9176d4b81a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d87660bc077d60418c53516a7402ac37f99fc53f8ffbe6cb61fba53b7742188b8feb1d996f47ebb069809e486887cdcc4677ba9480a66ccaa007ba6365863f0
|
|
7
|
+
data.tar.gz: 8cc38a72a9b0ed674a5e1af38327389af6f34b20589dc4c0ec63853f4bf27050f1233b2ad66ca29db054a2d249a4df00c8a1cc68e3fdca9686a7651a8d2cac8d
|
data/.github/dependabot.yml
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
# Specify a different separator for branch names
|
|
2
|
-
|
|
3
1
|
version: 2
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
|
|
3
|
+
multi-ecosystem-groups:
|
|
4
|
+
security:
|
|
7
5
|
schedule:
|
|
8
|
-
interval: '
|
|
6
|
+
interval: 'daily'
|
|
7
|
+
open-pull-requests-limit: 0 # disables version-update PRs; security PRs unaffected
|
|
9
8
|
pull-request-branch-name:
|
|
10
9
|
separator: '-'
|
|
10
|
+
|
|
11
|
+
updates:
|
|
12
|
+
- package-ecosystem: 'bundler'
|
|
13
|
+
directory: '/'
|
|
14
|
+
patterns: ['*']
|
|
15
|
+
multi-ecosystem-group: 'security'
|
|
16
|
+
|
|
17
|
+
- package-ecosystem: 'github-actions'
|
|
18
|
+
directory: '/'
|
|
19
|
+
patterns: ['*']
|
|
20
|
+
multi-ecosystem-group: 'security'
|
data/.github/workflows/build.yml
CHANGED
data/.rubocop.yml
CHANGED
data/.tool-versions
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
ruby 4.0.
|
|
2
|
-
nodejs 24.
|
|
1
|
+
ruby 4.0.5
|
|
2
|
+
nodejs 24.16.0
|
data/CHANGELOG.md
CHANGED
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# ears
|
|
2
|
+
|
|
3
|
+
Ruby gem for building RabbitMQ consumers using Bunny.
|
|
4
|
+
|
|
5
|
+
## Stack
|
|
6
|
+
|
|
7
|
+
- **Ruby** 4.0.x (see `.tool-versions`)
|
|
8
|
+
- **Bunny** >= 3.0.0 — AMQP client
|
|
9
|
+
- **connection_pool** ~> 3.0 — thread-safe channel pools for publishers
|
|
10
|
+
- **json** >= 2.9.0 — JSON serialization in middleware
|
|
11
|
+
- Dev tools: RSpec, RuboCop (rubocop-rspec, rubocop-rake), SimpleCov, YARD, Prettier (via Node)
|
|
12
|
+
|
|
13
|
+
## Common Commands
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Install deps
|
|
17
|
+
bundle install
|
|
18
|
+
npm install
|
|
19
|
+
|
|
20
|
+
# Tests
|
|
21
|
+
bundle exec rspec
|
|
22
|
+
|
|
23
|
+
# Lint / format
|
|
24
|
+
bundle exec rubocop
|
|
25
|
+
npm run lint # Prettier on Ruby files
|
|
26
|
+
|
|
27
|
+
# Autofix rubocop
|
|
28
|
+
bundle exec rubocop -A
|
|
29
|
+
|
|
30
|
+
# Docs
|
|
31
|
+
bundle exec yard doc
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Directory Layout
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
lib/
|
|
38
|
+
ears.rb # Top-level module: configure, connection, channel, setup, run!
|
|
39
|
+
ears/
|
|
40
|
+
configuration.rb # Ears::Configuration — all tunable constants
|
|
41
|
+
errors.rb # Custom error classes (required by configuration.rb)
|
|
42
|
+
consumer.rb # Abstract base class; subclass and override #work
|
|
43
|
+
consumer_wrapper.rb # Wraps a Consumer for Bunny delivery callbacks
|
|
44
|
+
setup.rb # Ears::Setup — DSL for exchange/queue/consumer wiring
|
|
45
|
+
publisher.rb # Ears::Publisher — publish and publish_with_confirmation
|
|
46
|
+
publisher_channel_pool.rb # Thread-safe ConnectionPool for publisher channels
|
|
47
|
+
publisher_confirmation_handler.rb
|
|
48
|
+
publisher_retry_handler.rb
|
|
49
|
+
middleware.rb # Middleware base
|
|
50
|
+
middlewares/
|
|
51
|
+
appsignal.rb
|
|
52
|
+
json.rb # Deserializes JSON payload before #work
|
|
53
|
+
max_retries.rb
|
|
54
|
+
testing.rb # Ears::Testing module entry-point
|
|
55
|
+
testing/
|
|
56
|
+
matchers.rb
|
|
57
|
+
message_capture.rb
|
|
58
|
+
publisher_mock.rb
|
|
59
|
+
test_helper.rb
|
|
60
|
+
spec/ # RSpec specs (mirrors lib/ structure)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Architecture
|
|
64
|
+
|
|
65
|
+
**Consumer pattern:** Subclass `Ears::Consumer`, call `.configure(queue:, exchange:, routing_keys:, ...)` in the class body, override `#work(delivery_info, metadata, payload)` returning `:ack`, `:reject`, or `:requeue`. Middleware chain is applied in reverse order around `#work`.
|
|
66
|
+
|
|
67
|
+
**Publisher pattern:** Instantiate `Ears::Publisher.new(exchange_name)`, call `#publish(data, routing_key:)` or `#publish_with_confirmation(data, routing_key:)`. Internally uses `PublisherChannelPool` (two `ConnectionPool` instances — one standard, one with confirms). Pool is lazy-initialised with a mutex for thread safety and is fork-safe (resets on PID change).
|
|
68
|
+
|
|
69
|
+
**Setup DSL:** `Ears.setup { exchange(...); queue(...); consumer(...) }` or `Ears.setup_consumers(*classes)` which auto-wires from each class's `.configure` metadata.
|
|
70
|
+
|
|
71
|
+
**Configuration knobs** (set via `Ears.configure { |c| c.foo = ... }`): `rabbitmq_url`, `connection_name` (required), `publisher_pool_size` (32), `publisher_pool_timeout` (2s), `publisher_confirms_pool_size` (32), `publisher_confirms_timeout` (5s), plus retry/backoff params.
|
|
72
|
+
|
|
73
|
+
## Testing Support
|
|
74
|
+
|
|
75
|
+
`require 'ears/testing'` — provides `Ears::Testing::TestHelper` (RSpec include), `PublisherMock`, `MessageCapture`, and custom matchers (`have_been_published`).
|
|
76
|
+
|
|
77
|
+
## Known Tech Debt
|
|
78
|
+
|
|
79
|
+
- `Metrics/MethodLength` is suppressed for `Configuration#initialize` (initialises ~15 instance variables from constants; an options-hash refactor would be the real fix).
|
|
80
|
+
- `.rubocop_todo.yml` may have lingering entries — check before adding new inline disables.
|
data/Gemfile.lock
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
ears (0.
|
|
4
|
+
ears (0.26.0)
|
|
5
5
|
bunny (>= 3.0.0)
|
|
6
|
-
connection_pool (~>
|
|
6
|
+
connection_pool (~> 3.0)
|
|
7
7
|
json (>= 2.9.0)
|
|
8
8
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
amq-protocol (2.
|
|
12
|
+
amq-protocol (2.8.0)
|
|
13
13
|
ast (2.4.3)
|
|
14
14
|
bunny (3.1.0)
|
|
15
15
|
amq-protocol (~> 2.7)
|
|
16
16
|
logger (~> 1, >= 1.7)
|
|
17
17
|
sorted_set (~> 1, >= 1.0.2)
|
|
18
|
-
connection_pool (
|
|
18
|
+
connection_pool (3.0.2)
|
|
19
19
|
diff-lcs (1.6.2)
|
|
20
20
|
docile (1.4.1)
|
|
21
|
-
json (2.19.
|
|
21
|
+
json (2.19.7)
|
|
22
22
|
language_server-protocol (3.17.0.5)
|
|
23
23
|
lint_roller (1.1.0)
|
|
24
24
|
logger (1.7.0)
|
|
25
|
-
parallel (1.
|
|
25
|
+
parallel (2.1.0)
|
|
26
26
|
parser (3.3.11.1)
|
|
27
27
|
ast (~> 2.4.1)
|
|
28
28
|
racc
|
|
@@ -30,7 +30,7 @@ GEM
|
|
|
30
30
|
prism (1.9.0)
|
|
31
31
|
racc (1.8.1)
|
|
32
32
|
rainbow (3.1.1)
|
|
33
|
-
rake (13.
|
|
33
|
+
rake (13.4.2)
|
|
34
34
|
rbtree (0.4.6)
|
|
35
35
|
regexp_parser (2.12.0)
|
|
36
36
|
rspec (3.13.2)
|
|
@@ -46,11 +46,11 @@ GEM
|
|
|
46
46
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
47
47
|
rspec-support (~> 3.13.0)
|
|
48
48
|
rspec-support (3.13.7)
|
|
49
|
-
rubocop (1.
|
|
49
|
+
rubocop (1.87.0)
|
|
50
50
|
json (~> 2.3)
|
|
51
51
|
language_server-protocol (~> 3.17.0.2)
|
|
52
52
|
lint_roller (~> 1.1.0)
|
|
53
|
-
parallel (
|
|
53
|
+
parallel (>= 1.10)
|
|
54
54
|
parser (>= 3.3.0.2)
|
|
55
55
|
rainbow (>= 2.2.2, < 4.0)
|
|
56
56
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
@@ -80,7 +80,7 @@ GEM
|
|
|
80
80
|
unicode-display_width (3.2.0)
|
|
81
81
|
unicode-emoji (~> 4.1)
|
|
82
82
|
unicode-emoji (4.2.0)
|
|
83
|
-
yard (0.9.
|
|
83
|
+
yard (0.9.44)
|
|
84
84
|
|
|
85
85
|
PLATFORMS
|
|
86
86
|
arm64-darwin
|
|
@@ -100,24 +100,25 @@ DEPENDENCIES
|
|
|
100
100
|
yard
|
|
101
101
|
|
|
102
102
|
CHECKSUMS
|
|
103
|
-
amq-protocol (2.
|
|
103
|
+
amq-protocol (2.8.0) sha256=d06bbb341fa683459954f5a854388dac729171500116d81311cfbeaad83392ab
|
|
104
104
|
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
|
|
105
|
+
bundler (4.0.12) sha256=7f8b757d28dfb636e7b24fba2344ac6dd13b5b24f4b46d62573d483f211825ac
|
|
105
106
|
bunny (3.1.0) sha256=fd09ea8be3fbb7fe4b1063f874094b444f762f2da1692b3341751af7c6d62f3c
|
|
106
|
-
connection_pool (
|
|
107
|
+
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
|
|
107
108
|
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
|
|
108
109
|
docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
|
|
109
|
-
ears (0.
|
|
110
|
-
json (2.19.
|
|
110
|
+
ears (0.26.0)
|
|
111
|
+
json (2.19.7) sha256=fe432c8639f6efff69f9d73b518a3705d9581ab93156f981ea72806e1e5bcc3e
|
|
111
112
|
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
|
|
112
113
|
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
|
113
114
|
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
114
|
-
parallel (1.
|
|
115
|
+
parallel (2.1.0) sha256=b35258865c2e31134c5ecb708beaaf6772adf9d5efae28e93e99260877b09356
|
|
115
116
|
parser (3.3.11.1) sha256=d17ace7aabe3e72c3cc94043714be27cc6f852f104d81aa284c2281aecc65d54
|
|
116
117
|
prettier_print (1.2.1) sha256=a72838b5f23facff21f90a5423cdcdda19e4271092b41f4ea7f50b83929e6ff9
|
|
117
118
|
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
|
|
118
119
|
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
|
|
119
120
|
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
|
|
120
|
-
rake (13.
|
|
121
|
+
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
|
|
121
122
|
rbtree (0.4.6) sha256=14eea4469b24fd2472542e5f3eb105d6344c8ccf36f0b56d55fdcfeb4e0f10fc
|
|
122
123
|
regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
|
|
123
124
|
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
|
|
@@ -125,7 +126,7 @@ CHECKSUMS
|
|
|
125
126
|
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
|
|
126
127
|
rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
|
|
127
128
|
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
|
|
128
|
-
rubocop (1.
|
|
129
|
+
rubocop (1.87.0) sha256=b9d9ddf55116a513f8ef2c7ae660662d8b49301f118d3f0df61865b33a5c188d
|
|
129
130
|
rubocop-ast (1.49.1) sha256=4412f3ee70f6fe4546cc489548e0f6fcf76cafcfa80fa03af67098ffed755035
|
|
130
131
|
rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d
|
|
131
132
|
rubocop-rspec (3.9.0) sha256=8fa70a3619408237d789aeecfb9beef40576acc855173e60939d63332fdb55e2
|
|
@@ -137,7 +138,7 @@ CHECKSUMS
|
|
|
137
138
|
syntax_tree (6.3.0) sha256=56e25a9692c798ec94c5442fe94c5e94af76bef91edc8bb02052cbdecf35f13d
|
|
138
139
|
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
|
|
139
140
|
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
|
|
140
|
-
yard (0.9.
|
|
141
|
+
yard (0.9.44) sha256=eb087e9b631ccd887b049f303d489963945452d5e2a7eb49a5a74a7cf6887f28
|
|
141
142
|
|
|
142
143
|
BUNDLED WITH
|
|
143
|
-
4.0.
|
|
144
|
+
4.0.12
|
data/ears.gemspec
CHANGED
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
spec.description = 'A gem for building RabbitMQ consumers.'
|
|
11
11
|
spec.homepage = 'https://github.com/ivx/ears'
|
|
12
12
|
spec.license = 'MIT'
|
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 3.
|
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 3.3.0')
|
|
14
14
|
|
|
15
15
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
|
16
16
|
|
|
@@ -33,6 +33,6 @@ Gem::Specification.new do |spec|
|
|
|
33
33
|
spec.require_paths = ['lib']
|
|
34
34
|
|
|
35
35
|
spec.add_dependency 'bunny', '>= 3.0.0'
|
|
36
|
-
spec.add_dependency 'connection_pool', '~>
|
|
36
|
+
spec.add_dependency 'connection_pool', '~> 3.0'
|
|
37
37
|
spec.add_dependency 'json', '>= 2.9.0'
|
|
38
38
|
end
|
data/lib/ears/version.rb
CHANGED
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.8.
|
|
11
|
+
"prettier": "^3.8.3"
|
|
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.8.
|
|
34
|
-
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.
|
|
35
|
-
"integrity": "sha512-
|
|
33
|
+
"version": "3.8.3",
|
|
34
|
+
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz",
|
|
35
|
+
"integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==",
|
|
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.8.
|
|
66
|
-
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.
|
|
67
|
-
"integrity": "sha512-
|
|
65
|
+
"version": "3.8.3",
|
|
66
|
+
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz",
|
|
67
|
+
"integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==",
|
|
68
68
|
"dev": true
|
|
69
69
|
}
|
|
70
70
|
}
|
data/package.json
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ears
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.26.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- InVision AG
|
|
@@ -29,14 +29,14 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
32
|
+
version: '3.0'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '
|
|
39
|
+
version: '3.0'
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: json
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -69,6 +69,7 @@ files:
|
|
|
69
69
|
- ".tool-versions"
|
|
70
70
|
- ".yardopts"
|
|
71
71
|
- CHANGELOG.md
|
|
72
|
+
- CLAUDE.md
|
|
72
73
|
- CODEOWNERS
|
|
73
74
|
- CODE_OF_CONDUCT.md
|
|
74
75
|
- Gemfile
|
|
@@ -115,14 +116,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
115
116
|
requirements:
|
|
116
117
|
- - ">="
|
|
117
118
|
- !ruby/object:Gem::Version
|
|
118
|
-
version: 3.
|
|
119
|
+
version: 3.3.0
|
|
119
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
121
|
requirements:
|
|
121
122
|
- - ">="
|
|
122
123
|
- !ruby/object:Gem::Version
|
|
123
124
|
version: '0'
|
|
124
125
|
requirements: []
|
|
125
|
-
rubygems_version: 4.0.
|
|
126
|
+
rubygems_version: 4.0.10
|
|
126
127
|
specification_version: 4
|
|
127
128
|
summary: A gem for building RabbitMQ consumers.
|
|
128
129
|
test_files: []
|