ears 0.12.0 → 0.14.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 +10 -0
- data/.github/workflows/build.yml +5 -5
- data/.github/workflows/codeql.yml +4 -4
- data/.github/workflows/dependency-review.yml +2 -2
- data/.rspec +0 -1
- data/.tool-versions +2 -2
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +41 -47
- data/README.md +73 -5
- data/ears.gemspec +1 -7
- data/lib/ears/consumer.rb +4 -4
- data/lib/ears/middlewares/appsignal.rb +6 -8
- data/lib/ears/setup.rb +7 -1
- data/lib/ears/version.rb +1 -1
- data/package-lock.json +22 -21
- data/package.json +3 -3
- metadata +5 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3a6fcd7ee80d0254935971a568d43154299dc43fae10d67814343be176960b18
|
|
4
|
+
data.tar.gz: c8e836139cedf43f004be9e6b1d20d3d74b6a39cb041402b1762ae0cd77855d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce44978ab6bbb2c52c0f890ccbddeb2e64968301e03522e1317a4519f6ea1e87f87dee4cf9da77030d635f55e812d5a296d551468803b6c42ba1033a02bcdac3
|
|
7
|
+
data.tar.gz: cbf4b43f647ec78772430fa821fb893d2c93c032c368023e5dfbf3760d23599ca964a15be157b25b3512d6d8de536799971255ccda2df4cd6915c5188b420e25
|
data/.github/workflows/build.yml
CHANGED
|
@@ -12,18 +12,18 @@ jobs:
|
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
strategy:
|
|
14
14
|
matrix:
|
|
15
|
-
ruby-version: ['2.7', '3.0', '3.1', '3.2']
|
|
15
|
+
ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3']
|
|
16
16
|
|
|
17
17
|
steps:
|
|
18
|
-
- uses: actions/checkout@
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
19
|
- name: Set up Ruby
|
|
20
20
|
uses: ruby/setup-ruby@v1
|
|
21
21
|
with:
|
|
22
22
|
ruby-version: ${{ matrix.ruby-version }}
|
|
23
23
|
bundler-cache: true
|
|
24
|
-
- uses: actions/setup-node@
|
|
24
|
+
- uses: actions/setup-node@v4
|
|
25
25
|
with:
|
|
26
|
-
node-version: '
|
|
26
|
+
node-version: '22'
|
|
27
27
|
- name: Run prettier
|
|
28
28
|
run: npm ci && npm run lint
|
|
29
29
|
- name: Run Rubocop
|
|
@@ -37,7 +37,7 @@ jobs:
|
|
|
37
37
|
runs-on: ubuntu-latest
|
|
38
38
|
|
|
39
39
|
steps:
|
|
40
|
-
- uses: actions/checkout@
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
41
|
- name: Set up Ruby
|
|
42
42
|
uses: ruby/setup-ruby@v1
|
|
43
43
|
with:
|
|
@@ -41,11 +41,11 @@ jobs:
|
|
|
41
41
|
|
|
42
42
|
steps:
|
|
43
43
|
- name: Checkout repository
|
|
44
|
-
uses: actions/checkout@
|
|
44
|
+
uses: actions/checkout@v4
|
|
45
45
|
|
|
46
46
|
# Initializes the CodeQL tools for scanning.
|
|
47
47
|
- name: Initialize CodeQL
|
|
48
|
-
uses: github/codeql-action/init@
|
|
48
|
+
uses: github/codeql-action/init@v3
|
|
49
49
|
with:
|
|
50
50
|
languages: ${{ matrix.language }}
|
|
51
51
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
@@ -58,7 +58,7 @@ jobs:
|
|
|
58
58
|
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
|
59
59
|
# If this step fails, then you should remove it and run the build manually (see below)
|
|
60
60
|
- name: Autobuild
|
|
61
|
-
uses: github/codeql-action/autobuild@
|
|
61
|
+
uses: github/codeql-action/autobuild@v3
|
|
62
62
|
|
|
63
63
|
# ℹ️ Command-line programs to run using the OS shell.
|
|
64
64
|
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
@@ -71,6 +71,6 @@ jobs:
|
|
|
71
71
|
# ./location_of_script_within_repo/buildscript.sh
|
|
72
72
|
|
|
73
73
|
- name: Perform CodeQL Analysis
|
|
74
|
-
uses: github/codeql-action/analyze@
|
|
74
|
+
uses: github/codeql-action/analyze@v3
|
|
75
75
|
with:
|
|
76
76
|
category: '/language:${{matrix.language}}'
|
data/.rspec
CHANGED
data/.tool-versions
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
ruby 2.7.
|
|
2
|
-
nodejs
|
|
1
|
+
ruby 2.7.8
|
|
2
|
+
nodejs 22.5.1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.14.0 (2024-07-29)
|
|
4
|
+
|
|
5
|
+
- **[Breaking]** Adjust Appsignal middleware to use `Appsignal.monitor`.
|
|
6
|
+
To use the middleware the `appsignal` gem in version `>= 3.11.0` is required.
|
|
7
|
+
The configuration of the middleware changed and now only requires one option `class_name` and an optional `namespace`.
|
|
8
|
+
|
|
9
|
+
## 0.13.0 (2023-11-07)
|
|
10
|
+
|
|
11
|
+
- Allow adding multiple routing keys to the consumer configuration, configure method within consumer will only accept `routing_keys` array instead of `routing_key` string
|
|
12
|
+
|
|
3
13
|
## 0.12.0 (2023-10-26)
|
|
4
14
|
|
|
5
15
|
- add new interface to setup consumers including their exchange, queue and binding the queue to the exchange via routing key via `Ears.setup_consumers` and `configure(queue:, exchange:,routing_key:, ...)` for Ears::Consumers subclasses
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
ears (0.
|
|
4
|
+
ears (0.14.0)
|
|
5
5
|
bunny (~> 2.22.0)
|
|
6
6
|
multi_json
|
|
7
7
|
|
|
@@ -10,74 +10,67 @@ GEM
|
|
|
10
10
|
specs:
|
|
11
11
|
amq-protocol (2.3.2)
|
|
12
12
|
ast (2.4.2)
|
|
13
|
-
base64 (0.1.1)
|
|
14
13
|
bunny (2.22.0)
|
|
15
14
|
amq-protocol (~> 2.3, >= 2.3.1)
|
|
16
15
|
sorted_set (~> 1, >= 1.0.2)
|
|
17
|
-
diff-lcs (1.5.
|
|
18
|
-
docile (1.4.
|
|
19
|
-
haml (6.
|
|
16
|
+
diff-lcs (1.5.1)
|
|
17
|
+
docile (1.4.1)
|
|
18
|
+
haml (6.3.0)
|
|
20
19
|
temple (>= 0.8.2)
|
|
21
20
|
thor
|
|
22
21
|
tilt
|
|
23
|
-
json (2.
|
|
22
|
+
json (2.7.2)
|
|
24
23
|
language_server-protocol (3.17.0.3)
|
|
25
24
|
multi_json (1.15.0)
|
|
26
|
-
parallel (1.
|
|
27
|
-
parser (3.
|
|
25
|
+
parallel (1.25.1)
|
|
26
|
+
parser (3.3.4.0)
|
|
28
27
|
ast (~> 2.4.1)
|
|
29
28
|
racc
|
|
30
|
-
prettier (4.0.
|
|
29
|
+
prettier (4.0.4)
|
|
31
30
|
syntax_tree (>= 4.0.1)
|
|
32
31
|
syntax_tree-haml (>= 2.0.0)
|
|
33
32
|
syntax_tree-rbs (>= 0.2.0)
|
|
34
33
|
prettier_print (1.2.1)
|
|
35
|
-
racc (1.
|
|
34
|
+
racc (1.8.0)
|
|
36
35
|
rainbow (3.1.1)
|
|
37
|
-
rake (13.
|
|
36
|
+
rake (13.2.1)
|
|
38
37
|
rbs (3.1.3)
|
|
39
38
|
rbtree (0.4.6)
|
|
40
|
-
regexp_parser (2.
|
|
41
|
-
rexml (3.2
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
rspec-
|
|
45
|
-
rspec-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
regexp_parser (2.9.2)
|
|
40
|
+
rexml (3.3.2)
|
|
41
|
+
strscan
|
|
42
|
+
rspec (3.13.0)
|
|
43
|
+
rspec-core (~> 3.13.0)
|
|
44
|
+
rspec-expectations (~> 3.13.0)
|
|
45
|
+
rspec-mocks (~> 3.13.0)
|
|
46
|
+
rspec-core (3.13.0)
|
|
47
|
+
rspec-support (~> 3.13.0)
|
|
48
|
+
rspec-expectations (3.13.1)
|
|
49
49
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
50
|
-
rspec-support (~> 3.
|
|
51
|
-
rspec-mocks (3.
|
|
50
|
+
rspec-support (~> 3.13.0)
|
|
51
|
+
rspec-mocks (3.13.1)
|
|
52
52
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
53
|
-
rspec-support (~> 3.
|
|
54
|
-
rspec-support (3.
|
|
55
|
-
rubocop (1.
|
|
56
|
-
base64 (~> 0.1.1)
|
|
53
|
+
rspec-support (~> 3.13.0)
|
|
54
|
+
rspec-support (3.13.1)
|
|
55
|
+
rubocop (1.65.0)
|
|
57
56
|
json (~> 2.3)
|
|
58
57
|
language_server-protocol (>= 3.17.0)
|
|
59
58
|
parallel (~> 1.10)
|
|
60
|
-
parser (>= 3.
|
|
59
|
+
parser (>= 3.3.0.2)
|
|
61
60
|
rainbow (>= 2.2.2, < 4.0)
|
|
62
|
-
regexp_parser (>=
|
|
61
|
+
regexp_parser (>= 2.4, < 3.0)
|
|
63
62
|
rexml (>= 3.2.5, < 4.0)
|
|
64
|
-
rubocop-ast (>= 1.
|
|
63
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
|
65
64
|
ruby-progressbar (~> 1.7)
|
|
66
65
|
unicode-display_width (>= 2.4.0, < 3.0)
|
|
67
|
-
rubocop-ast (1.
|
|
68
|
-
parser (>= 3.
|
|
69
|
-
rubocop-capybara (2.18.0)
|
|
70
|
-
rubocop (~> 1.41)
|
|
71
|
-
rubocop-factory_bot (2.24.0)
|
|
72
|
-
rubocop (~> 1.33)
|
|
66
|
+
rubocop-ast (1.31.3)
|
|
67
|
+
parser (>= 3.3.1.0)
|
|
73
68
|
rubocop-rake (0.6.0)
|
|
74
69
|
rubocop (~> 1.0)
|
|
75
|
-
rubocop-rspec (
|
|
76
|
-
rubocop (~> 1.
|
|
77
|
-
rubocop-capybara (~> 2.17)
|
|
78
|
-
rubocop-factory_bot (~> 2.22)
|
|
70
|
+
rubocop-rspec (3.0.3)
|
|
71
|
+
rubocop (~> 1.61)
|
|
79
72
|
ruby-progressbar (1.13.0)
|
|
80
|
-
set (1.0.
|
|
73
|
+
set (1.0.4)
|
|
81
74
|
simplecov (0.22.0)
|
|
82
75
|
docile (~> 1.1)
|
|
83
76
|
simplecov-html (~> 0.11)
|
|
@@ -87,7 +80,8 @@ GEM
|
|
|
87
80
|
sorted_set (1.0.3)
|
|
88
81
|
rbtree
|
|
89
82
|
set (~> 1.0)
|
|
90
|
-
|
|
83
|
+
strscan (3.1.0)
|
|
84
|
+
syntax_tree (6.2.0)
|
|
91
85
|
prettier_print (>= 1.2.0)
|
|
92
86
|
syntax_tree-haml (4.0.3)
|
|
93
87
|
haml (>= 5.2)
|
|
@@ -97,11 +91,11 @@ GEM
|
|
|
97
91
|
prettier_print
|
|
98
92
|
rbs
|
|
99
93
|
syntax_tree (>= 2.0.1)
|
|
100
|
-
temple (0.10.
|
|
101
|
-
thor (1.
|
|
102
|
-
tilt (2.
|
|
103
|
-
unicode-display_width (2.
|
|
104
|
-
yard (0.9.
|
|
94
|
+
temple (0.10.3)
|
|
95
|
+
thor (1.3.1)
|
|
96
|
+
tilt (2.4.0)
|
|
97
|
+
unicode-display_width (2.5.0)
|
|
98
|
+
yard (0.9.36)
|
|
105
99
|
|
|
106
100
|
PLATFORMS
|
|
107
101
|
arm64-darwin-20
|
|
@@ -125,4 +119,4 @@ DEPENDENCIES
|
|
|
125
119
|
yard
|
|
126
120
|
|
|
127
121
|
BUNDLED WITH
|
|
128
|
-
2.4.
|
|
122
|
+
2.4.22
|
data/README.md
CHANGED
|
@@ -39,7 +39,39 @@ end
|
|
|
39
39
|
|
|
40
40
|
_Note_: `connection_name` is a mandatory setting!
|
|
41
41
|
|
|
42
|
-
Next, define your exchanges, queues, and consumers
|
|
42
|
+
Next, you can define your exchanges, queues, and consumers in 2 ways:
|
|
43
|
+
|
|
44
|
+
#### 1. consumer specific configuration method (recommended)
|
|
45
|
+
|
|
46
|
+
1. Pass your consumer classes to `Ears.setup`:
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
Ears.setup do
|
|
50
|
+
Ears.setup_consumers(Consumer1, Consumer2, ...)
|
|
51
|
+
end
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
2. Implement your consumers by subclassing `Ears::Consumer`. and call the configure method.
|
|
55
|
+
|
|
56
|
+
```ruby
|
|
57
|
+
class Consumer1 < Ears::Consumer
|
|
58
|
+
configure(
|
|
59
|
+
queue: 'queue_name',
|
|
60
|
+
exchange: 'exchange',
|
|
61
|
+
routing_keys: %w[routing_key1 routing_key2],
|
|
62
|
+
retry_queue: true, # optional configuration, defaults to false, Adds a retry queue
|
|
63
|
+
error_queue: true, # optional configuration, defaults to false, Adds an error queue
|
|
64
|
+
)
|
|
65
|
+
def work(delivery_info, metadata, payload)
|
|
66
|
+
message = JSON.parse(payload)
|
|
67
|
+
do_stuff(message)
|
|
68
|
+
|
|
69
|
+
ack
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### 2. Generic configuration method
|
|
43
75
|
|
|
44
76
|
```ruby
|
|
45
77
|
Ears.setup do
|
|
@@ -57,7 +89,7 @@ Ears.setup do
|
|
|
57
89
|
end
|
|
58
90
|
```
|
|
59
91
|
|
|
60
|
-
Finally, you need to implement `MyConsumer` by subclassing `Ears::Consumer`.
|
|
92
|
+
Finally, you need to implement `MyConsumer` by subclassing `Ears::Consumer`. and call the configure method.
|
|
61
93
|
|
|
62
94
|
```ruby
|
|
63
95
|
class MyConsumer < Ears::Consumer
|
|
@@ -70,7 +102,9 @@ class MyConsumer < Ears::Consumer
|
|
|
70
102
|
end
|
|
71
103
|
```
|
|
72
104
|
|
|
73
|
-
|
|
105
|
+
### Run your consumers
|
|
106
|
+
|
|
107
|
+
Note: Be prepared that unhandled errors will be reraised. So, take care of cleanup work.
|
|
74
108
|
|
|
75
109
|
```ruby
|
|
76
110
|
begin
|
|
@@ -165,7 +199,24 @@ end
|
|
|
165
199
|
|
|
166
200
|
### Implementing a retrying queue
|
|
167
201
|
|
|
168
|
-
Sometimes you want to automatically retry processing a message, in case it just failed due to temporary problems. In that case, you can set the `retry_queue` and `retry_delay` parameters when creating the queue.
|
|
202
|
+
Sometimes you want to automatically retry processing a message, in case it just failed due to temporary problems. In that case, you can set the `retry_queue` and `retry_delay` parameters when creating the queue OR pass it to the configure method in your consumer.
|
|
203
|
+
|
|
204
|
+
```ruby
|
|
205
|
+
class MyConsumer < Ears::Consumer
|
|
206
|
+
configure(
|
|
207
|
+
queue: 'queue_name',
|
|
208
|
+
exchange: 'exchange',
|
|
209
|
+
routing_keys: %w[routing_key1 routing_key2],
|
|
210
|
+
retry_queue: true,
|
|
211
|
+
)
|
|
212
|
+
def work(delivery_info, metadata, payload)
|
|
213
|
+
message = JSON.parse(payload)
|
|
214
|
+
do_stuff(message)
|
|
215
|
+
|
|
216
|
+
ack
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
```
|
|
169
220
|
|
|
170
221
|
```ruby
|
|
171
222
|
my_queue =
|
|
@@ -178,7 +229,24 @@ This will happen indefinitely, so if you want to bail out of this cycle at some
|
|
|
178
229
|
|
|
179
230
|
### Implementing an error queue
|
|
180
231
|
|
|
181
|
-
You can set the `error_queue` parameter to automatically create an error queue.
|
|
232
|
+
You can set the `error_queue` parameter to automatically create an error queue, or add it to the configure method in your consumer.
|
|
233
|
+
|
|
234
|
+
```ruby
|
|
235
|
+
class MyConsumer < Ears::Consumer
|
|
236
|
+
configure(
|
|
237
|
+
queue: 'queue_name',
|
|
238
|
+
exchange: 'exchange',
|
|
239
|
+
routing_keys: %w[routing_key1 routing_key2],
|
|
240
|
+
error_queue: true,
|
|
241
|
+
)
|
|
242
|
+
def work(delivery_info, metadata, payload)
|
|
243
|
+
message = JSON.parse(payload)
|
|
244
|
+
do_stuff(message)
|
|
245
|
+
|
|
246
|
+
ack
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
```
|
|
182
250
|
|
|
183
251
|
```ruby
|
|
184
252
|
my_queue =
|
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('>= 2.7.
|
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.7')
|
|
14
14
|
|
|
15
15
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
|
16
16
|
|
|
@@ -23,12 +23,6 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
'changelog_uri'
|
|
24
24
|
] = 'https://github.com/ivx/ears/blob/main/CHANGELOG.md'
|
|
25
25
|
|
|
26
|
-
spec.post_install_message =
|
|
27
|
-
'
|
|
28
|
-
Ears: the new version changed the exit behaviour in case of uncaught exceptions.
|
|
29
|
-
You may want to have a look into the CHANGELOG!
|
|
30
|
-
'
|
|
31
|
-
|
|
32
26
|
spec.files =
|
|
33
27
|
Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
34
28
|
`git ls-files -z`.split("\x0")
|
data/lib/ears/consumer.rb
CHANGED
|
@@ -33,7 +33,7 @@ module Ears
|
|
|
33
33
|
# @param [Hash] opts The options to configure the consumer with.
|
|
34
34
|
# @option opts [String] :queue The name of the queue to consume from.
|
|
35
35
|
# @option opts [String] :exchange The name of the exchange the queue should be bound to.
|
|
36
|
-
# @option opts [
|
|
36
|
+
# @option opts [Array] :routing_keys The routing keys used for the queue binding.
|
|
37
37
|
# @option opts [Boolean] :durable_queue (true) Whether the queue should be durable.
|
|
38
38
|
# @option opts [Boolean] :retry_queue (false) Whether a retry queue should be provided.
|
|
39
39
|
# @option opts [Integer] :retry_delay (5000) The delay in milliseconds before retrying a message.
|
|
@@ -43,7 +43,7 @@ module Ears
|
|
|
43
43
|
def self.configure(opts = {})
|
|
44
44
|
self.queue = opts.fetch(:queue)
|
|
45
45
|
self.exchange = opts.fetch(:exchange)
|
|
46
|
-
self.
|
|
46
|
+
self.routing_keys = opts.fetch(:routing_keys)
|
|
47
47
|
self.queue_options = queue_options_from(opts: opts)
|
|
48
48
|
self.durable_exchange = opts.fetch(:durable_exchange, true)
|
|
49
49
|
self.exchange_type = opts.fetch(:exchange_type, :topic)
|
|
@@ -127,7 +127,7 @@ module Ears
|
|
|
127
127
|
class << self
|
|
128
128
|
attr_reader :queue,
|
|
129
129
|
:exchange,
|
|
130
|
-
:
|
|
130
|
+
:routing_keys,
|
|
131
131
|
:queue_options,
|
|
132
132
|
:durable_exchange,
|
|
133
133
|
:exchange_type
|
|
@@ -145,7 +145,7 @@ module Ears
|
|
|
145
145
|
|
|
146
146
|
attr_writer :queue,
|
|
147
147
|
:exchange,
|
|
148
|
-
:
|
|
148
|
+
:routing_keys,
|
|
149
149
|
:queue_options,
|
|
150
150
|
:durable_exchange,
|
|
151
151
|
:exchange_type
|
|
@@ -5,12 +5,12 @@ module Ears
|
|
|
5
5
|
# A middleware that automatically wraps {Ears::Consumer#work} in an Appsignal transaction.
|
|
6
6
|
class Appsignal < Middleware
|
|
7
7
|
# @param [Hash] opts The options for the middleware.
|
|
8
|
-
# @option opts [String] :transaction_name The name of the Appsignal transaction.
|
|
9
8
|
# @option opts [String] :class_name The name of the class you want to monitor.
|
|
9
|
+
# @option opts [String] :namespace ('background') The namespace in which the action should appear.
|
|
10
10
|
def initialize(opts)
|
|
11
11
|
super()
|
|
12
|
-
@transaction_name = opts.fetch(:transaction_name)
|
|
13
12
|
@class_name = opts.fetch(:class_name)
|
|
13
|
+
@namespace = opts.fetch(:namespace, 'background')
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def call(delivery_info, metadata, payload, app)
|
|
@@ -26,14 +26,12 @@ module Ears
|
|
|
26
26
|
|
|
27
27
|
private
|
|
28
28
|
|
|
29
|
-
attr_reader :
|
|
29
|
+
attr_reader :namespace, :class_name
|
|
30
30
|
|
|
31
31
|
def start_transaction(&block)
|
|
32
|
-
::Appsignal.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
method: 'work',
|
|
36
|
-
queue_start: Time.now.utc,
|
|
32
|
+
::Appsignal.monitor(
|
|
33
|
+
namespace: namespace,
|
|
34
|
+
action: "#{class_name}#work",
|
|
37
35
|
&block
|
|
38
36
|
)
|
|
39
37
|
end
|
data/lib/ears/setup.rb
CHANGED
|
@@ -76,10 +76,16 @@ module Ears
|
|
|
76
76
|
)
|
|
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
80
|
consumer(configured_queue, consumer_class)
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
+
def bind_queue_to_routing_keys(consumer_class, exchange, configured_queue)
|
|
84
|
+
consumer_class.routing_keys.each do |routing_key|
|
|
85
|
+
configured_queue.bind(exchange, routing_key: routing_key)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
83
89
|
def queue_options(bunny_opts, retry_arguments)
|
|
84
90
|
return bunny_opts unless retry_arguments
|
|
85
91
|
|
data/lib/ears/version.rb
CHANGED
data/package-lock.json
CHANGED
|
@@ -6,34 +6,35 @@
|
|
|
6
6
|
"": {
|
|
7
7
|
"name": "ears",
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@invisionag/prettier-config": "^2.1.
|
|
10
|
-
"@prettier/plugin-ruby": "^4.0.
|
|
11
|
-
"prettier": "^3.
|
|
9
|
+
"@invisionag/prettier-config": "^2.1.3",
|
|
10
|
+
"@prettier/plugin-ruby": "^4.0.4",
|
|
11
|
+
"prettier": "^3.3.3"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"node_modules/@invisionag/prettier-config": {
|
|
15
|
-
"version": "2.1.
|
|
16
|
-
"resolved": "https://registry.npmjs.org/@invisionag/prettier-config/-/prettier-config-2.1.
|
|
17
|
-
"integrity": "sha512-/
|
|
15
|
+
"version": "2.1.3",
|
|
16
|
+
"resolved": "https://registry.npmjs.org/@invisionag/prettier-config/-/prettier-config-2.1.3.tgz",
|
|
17
|
+
"integrity": "sha512-/BRe7iCWtsn43hhYrD2ANla2Qf332EusDjcuuB9xOK/z3lEghp59pkuxNFIvlQ/Y9AFMaT1zOFhvxzYax+fj3g==",
|
|
18
18
|
"dev": true,
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"prettier": ">=2.0.0"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"node_modules/@prettier/plugin-ruby": {
|
|
24
|
-
"version": "4.0.
|
|
25
|
-
"resolved": "https://registry.npmjs.org/@prettier/plugin-ruby/-/plugin-ruby-4.0.
|
|
26
|
-
"integrity": "sha512-
|
|
24
|
+
"version": "4.0.4",
|
|
25
|
+
"resolved": "https://registry.npmjs.org/@prettier/plugin-ruby/-/plugin-ruby-4.0.4.tgz",
|
|
26
|
+
"integrity": "sha512-lCpvfS/dQU5WrwN3AQ5vR8qrvj2h5gE41X08NNzAAXvHdM4zwwGRcP2sHSxfu6n6No+ljWCVx95NvJPFTTjCTg==",
|
|
27
27
|
"dev": true,
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"prettier": "^3.0.0"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"node_modules/prettier": {
|
|
33
|
-
"version": "3.
|
|
34
|
-
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.
|
|
35
|
-
"integrity": "sha512-
|
|
33
|
+
"version": "3.3.3",
|
|
34
|
+
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz",
|
|
35
|
+
"integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==",
|
|
36
36
|
"dev": true,
|
|
37
|
+
"license": "MIT",
|
|
37
38
|
"bin": {
|
|
38
39
|
"prettier": "bin/prettier.cjs"
|
|
39
40
|
},
|
|
@@ -47,23 +48,23 @@
|
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
49
50
|
"@invisionag/prettier-config": {
|
|
50
|
-
"version": "2.1.
|
|
51
|
-
"resolved": "https://registry.npmjs.org/@invisionag/prettier-config/-/prettier-config-2.1.
|
|
52
|
-
"integrity": "sha512-/
|
|
51
|
+
"version": "2.1.3",
|
|
52
|
+
"resolved": "https://registry.npmjs.org/@invisionag/prettier-config/-/prettier-config-2.1.3.tgz",
|
|
53
|
+
"integrity": "sha512-/BRe7iCWtsn43hhYrD2ANla2Qf332EusDjcuuB9xOK/z3lEghp59pkuxNFIvlQ/Y9AFMaT1zOFhvxzYax+fj3g==",
|
|
53
54
|
"dev": true,
|
|
54
55
|
"requires": {}
|
|
55
56
|
},
|
|
56
57
|
"@prettier/plugin-ruby": {
|
|
57
|
-
"version": "4.0.
|
|
58
|
-
"resolved": "https://registry.npmjs.org/@prettier/plugin-ruby/-/plugin-ruby-4.0.
|
|
59
|
-
"integrity": "sha512-
|
|
58
|
+
"version": "4.0.4",
|
|
59
|
+
"resolved": "https://registry.npmjs.org/@prettier/plugin-ruby/-/plugin-ruby-4.0.4.tgz",
|
|
60
|
+
"integrity": "sha512-lCpvfS/dQU5WrwN3AQ5vR8qrvj2h5gE41X08NNzAAXvHdM4zwwGRcP2sHSxfu6n6No+ljWCVx95NvJPFTTjCTg==",
|
|
60
61
|
"dev": true,
|
|
61
62
|
"requires": {}
|
|
62
63
|
},
|
|
63
64
|
"prettier": {
|
|
64
|
-
"version": "3.
|
|
65
|
-
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.
|
|
66
|
-
"integrity": "sha512-
|
|
65
|
+
"version": "3.3.3",
|
|
66
|
+
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz",
|
|
67
|
+
"integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==",
|
|
67
68
|
"dev": true
|
|
68
69
|
}
|
|
69
70
|
}
|
data/package.json
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
"format": "npm run prettify -- --write"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@invisionag/prettier-config": "^2.1.
|
|
11
|
-
"@prettier/plugin-ruby": "^4.0.
|
|
12
|
-
"prettier": "^3.
|
|
10
|
+
"@invisionag/prettier-config": "^2.1.3",
|
|
11
|
+
"@prettier/plugin-ruby": "^4.0.4",
|
|
12
|
+
"prettier": "^3.3.3"
|
|
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.
|
|
4
|
+
version: 0.14.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:
|
|
11
|
+
date: 2024-07-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bunny
|
|
@@ -45,6 +45,7 @@ executables: []
|
|
|
45
45
|
extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
|
47
47
|
files:
|
|
48
|
+
- ".github/dependabot.yml"
|
|
48
49
|
- ".github/workflows/build.yml"
|
|
49
50
|
- ".github/workflows/codeql.yml"
|
|
50
51
|
- ".github/workflows/dependency-review.yml"
|
|
@@ -84,10 +85,7 @@ metadata:
|
|
|
84
85
|
homepage_uri: https://github.com/ivx/ears
|
|
85
86
|
source_code_uri: https://github.com/ivx/ears
|
|
86
87
|
changelog_uri: https://github.com/ivx/ears/blob/main/CHANGELOG.md
|
|
87
|
-
post_install_message:
|
|
88
|
-
|
|
89
|
-
Ears: the new version changed the exit behaviour in case of uncaught exceptions.
|
|
90
|
-
You may want to have a look into the CHANGELOG!
|
|
88
|
+
post_install_message:
|
|
91
89
|
rdoc_options: []
|
|
92
90
|
require_paths:
|
|
93
91
|
- lib
|
|
@@ -95,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
95
93
|
requirements:
|
|
96
94
|
- - ">="
|
|
97
95
|
- !ruby/object:Gem::Version
|
|
98
|
-
version: 2.7.
|
|
96
|
+
version: 2.7.7
|
|
99
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
98
|
requirements:
|
|
101
99
|
- - ">="
|