rabbit_messaging 1.1.0 → 1.3.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/workflows/test.yml +2 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +5 -4
- data/Gemfile.lock +70 -196
- data/README.md +39 -21
- data/Rakefile +0 -2
- data/bin/console +4 -0
- data/config/sneakers.yml +9 -0
- data/environments/development.rb +1 -5
- data/lib/rabbit/daemon.rb +28 -11
- data/lib/rabbit/publishing.rb +4 -4
- data/lib/rabbit/receiving/job.rb +7 -6
- data/lib/rabbit/version.rb +1 -1
- data/lib/rabbit.rb +30 -8
- data/rabbit_messaging.gemspec +1 -3
- metadata +4 -34
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e91522365755a8fd4311204e3419daed0e81cbc30a4e47d72e8db6ff7a1230b2
|
|
4
|
+
data.tar.gz: 470eecbf8666625d4ca314d01c24c4d1de2b8a3896838bd127d86bc9e43226b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 35e7ba113d41de62dc9a5eceb5c7dc47e1398182889af1c54025d87f2c1bc05fc49d80d45a791151773843c23669720f5edc10f05cadc153820c6532b248186b
|
|
7
|
+
data.tar.gz: 75332f60efe6ed6485bf4dc8e36162f5e7d39f5df6134ca7a16c1ba9223ab06f790ee76a7a1892bfd3dd20411164abdf8d6947ca0fbbd7a670453ec3e9a9f8f0
|
data/.github/workflows/test.yml
CHANGED
|
@@ -13,12 +13,10 @@ jobs:
|
|
|
13
13
|
- uses: actions/checkout@v2
|
|
14
14
|
- uses: ruby/setup-ruby@v1
|
|
15
15
|
with:
|
|
16
|
-
ruby-version: "3.
|
|
16
|
+
ruby-version: "3.4"
|
|
17
17
|
bundler-cache: true
|
|
18
18
|
- name: Run Linter
|
|
19
19
|
run: bundle exec rubocop
|
|
20
|
-
- name: Run audit
|
|
21
|
-
run: bundle exec rake bundle:audit
|
|
22
20
|
- name: Run specs
|
|
23
21
|
run: bundle exec rspec
|
|
24
22
|
- name: Coveralls
|
|
@@ -34,7 +32,7 @@ jobs:
|
|
|
34
32
|
strategy:
|
|
35
33
|
fail-fast: false
|
|
36
34
|
matrix:
|
|
37
|
-
ruby: ["3.
|
|
35
|
+
ruby: ["3.1", "3.2", "3.3", "3.4"]
|
|
38
36
|
|
|
39
37
|
steps:
|
|
40
38
|
- uses: actions/checkout@v2
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
## [1.2.0] - 2025-02-10
|
|
5
|
+
### Added
|
|
6
|
+
- Add `ExponentialBackoffHandler` for handling errors in rabbit messages
|
|
7
|
+
- Optional `queue_suffix` config for read queues
|
|
8
|
+
|
|
4
9
|
## [1.1.0] - 2024-12-06
|
|
5
10
|
### Added
|
|
6
11
|
- **Receiving**
|
data/Gemfile
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
source "https://rubygems.org"
|
|
4
4
|
gemspec
|
|
5
5
|
|
|
6
|
-
gem "bundler"
|
|
7
|
-
gem "bundler-audit"
|
|
8
6
|
gem "pry"
|
|
9
|
-
gem "
|
|
10
|
-
gem "rake"
|
|
7
|
+
gem "reline"
|
|
11
8
|
gem "rspec"
|
|
12
9
|
gem "rspec-its"
|
|
13
10
|
gem "rubocop-config-umbrellio"
|
|
14
11
|
gem "simplecov"
|
|
15
12
|
gem "simplecov-lcov"
|
|
13
|
+
|
|
14
|
+
gem "activejob"
|
|
15
|
+
gem "activerecord"
|
|
16
|
+
gem "sneakers_handlers", github: "umbrellio/sneakers_handlers"
|
data/Gemfile.lock
CHANGED
|
@@ -1,269 +1,146 @@
|
|
|
1
|
+
GIT
|
|
2
|
+
remote: https://github.com/umbrellio/sneakers_handlers.git
|
|
3
|
+
revision: d4948218a76f2e510a14a72437f4dbd1ecdbef79
|
|
4
|
+
specs:
|
|
5
|
+
sneakers_handlers (0.1.0)
|
|
6
|
+
kicks
|
|
7
|
+
|
|
1
8
|
PATH
|
|
2
9
|
remote: .
|
|
3
10
|
specs:
|
|
4
|
-
rabbit_messaging (1.
|
|
11
|
+
rabbit_messaging (1.3.0)
|
|
5
12
|
bunny (~> 2.0)
|
|
6
|
-
kicks
|
|
7
|
-
lamian
|
|
8
|
-
rails (>= 6.1)
|
|
13
|
+
kicks
|
|
9
14
|
tainbox
|
|
10
15
|
|
|
11
16
|
GEM
|
|
12
17
|
remote: https://rubygems.org/
|
|
13
18
|
specs:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
activesupport (= 7.1.4.1)
|
|
17
|
-
nio4r (~> 2.0)
|
|
18
|
-
websocket-driver (>= 0.6.1)
|
|
19
|
-
zeitwerk (~> 2.6)
|
|
20
|
-
actionmailbox (7.1.4.1)
|
|
21
|
-
actionpack (= 7.1.4.1)
|
|
22
|
-
activejob (= 7.1.4.1)
|
|
23
|
-
activerecord (= 7.1.4.1)
|
|
24
|
-
activestorage (= 7.1.4.1)
|
|
25
|
-
activesupport (= 7.1.4.1)
|
|
26
|
-
mail (>= 2.7.1)
|
|
27
|
-
net-imap
|
|
28
|
-
net-pop
|
|
29
|
-
net-smtp
|
|
30
|
-
actionmailer (7.1.4.1)
|
|
31
|
-
actionpack (= 7.1.4.1)
|
|
32
|
-
actionview (= 7.1.4.1)
|
|
33
|
-
activejob (= 7.1.4.1)
|
|
34
|
-
activesupport (= 7.1.4.1)
|
|
35
|
-
mail (~> 2.5, >= 2.5.4)
|
|
36
|
-
net-imap
|
|
37
|
-
net-pop
|
|
38
|
-
net-smtp
|
|
39
|
-
rails-dom-testing (~> 2.2)
|
|
40
|
-
actionpack (7.1.4.1)
|
|
41
|
-
actionview (= 7.1.4.1)
|
|
42
|
-
activesupport (= 7.1.4.1)
|
|
43
|
-
nokogiri (>= 1.8.5)
|
|
44
|
-
racc
|
|
45
|
-
rack (>= 2.2.4)
|
|
46
|
-
rack-session (>= 1.0.1)
|
|
47
|
-
rack-test (>= 0.6.3)
|
|
48
|
-
rails-dom-testing (~> 2.2)
|
|
49
|
-
rails-html-sanitizer (~> 1.6)
|
|
50
|
-
actiontext (7.1.4.1)
|
|
51
|
-
actionpack (= 7.1.4.1)
|
|
52
|
-
activerecord (= 7.1.4.1)
|
|
53
|
-
activestorage (= 7.1.4.1)
|
|
54
|
-
activesupport (= 7.1.4.1)
|
|
55
|
-
globalid (>= 0.6.0)
|
|
56
|
-
nokogiri (>= 1.8.5)
|
|
57
|
-
actionview (7.1.4.1)
|
|
58
|
-
activesupport (= 7.1.4.1)
|
|
59
|
-
builder (~> 3.1)
|
|
60
|
-
erubi (~> 1.11)
|
|
61
|
-
rails-dom-testing (~> 2.2)
|
|
62
|
-
rails-html-sanitizer (~> 1.6)
|
|
63
|
-
activejob (7.1.4.1)
|
|
64
|
-
activesupport (= 7.1.4.1)
|
|
19
|
+
activejob (7.2.2.1)
|
|
20
|
+
activesupport (= 7.2.2.1)
|
|
65
21
|
globalid (>= 0.3.6)
|
|
66
|
-
activemodel (7.
|
|
67
|
-
activesupport (= 7.
|
|
68
|
-
activerecord (7.
|
|
69
|
-
activemodel (= 7.
|
|
70
|
-
activesupport (= 7.
|
|
22
|
+
activemodel (7.2.2.1)
|
|
23
|
+
activesupport (= 7.2.2.1)
|
|
24
|
+
activerecord (7.2.2.1)
|
|
25
|
+
activemodel (= 7.2.2.1)
|
|
26
|
+
activesupport (= 7.2.2.1)
|
|
71
27
|
timeout (>= 0.4.0)
|
|
72
|
-
|
|
73
|
-
actionpack (= 7.1.4.1)
|
|
74
|
-
activejob (= 7.1.4.1)
|
|
75
|
-
activerecord (= 7.1.4.1)
|
|
76
|
-
activesupport (= 7.1.4.1)
|
|
77
|
-
marcel (~> 1.0)
|
|
78
|
-
activesupport (7.1.4.1)
|
|
28
|
+
activesupport (7.2.2.1)
|
|
79
29
|
base64
|
|
30
|
+
benchmark (>= 0.3)
|
|
80
31
|
bigdecimal
|
|
81
|
-
concurrent-ruby (~> 1.0, >= 1.
|
|
32
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
82
33
|
connection_pool (>= 2.2.5)
|
|
83
34
|
drb
|
|
84
35
|
i18n (>= 1.6, < 2)
|
|
36
|
+
logger (>= 1.4.2)
|
|
85
37
|
minitest (>= 5.1)
|
|
86
|
-
|
|
87
|
-
tzinfo (~> 2.0)
|
|
38
|
+
securerandom (>= 0.3)
|
|
39
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
88
40
|
amq-protocol (2.3.2)
|
|
89
41
|
ast (2.4.2)
|
|
90
42
|
base64 (0.2.0)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
bundler-audit (0.9.2)
|
|
94
|
-
bundler (>= 1.2.0, < 3)
|
|
95
|
-
thor (~> 1.0)
|
|
43
|
+
benchmark (0.4.0)
|
|
44
|
+
bigdecimal (3.1.9)
|
|
96
45
|
bunny (2.23.0)
|
|
97
46
|
amq-protocol (~> 2.3, >= 2.3.1)
|
|
98
47
|
sorted_set (~> 1, >= 1.0.2)
|
|
99
48
|
coderay (1.1.3)
|
|
100
|
-
concurrent-ruby (1.3.
|
|
101
|
-
connection_pool (2.
|
|
102
|
-
crass (1.0.6)
|
|
103
|
-
date (3.3.4)
|
|
49
|
+
concurrent-ruby (1.3.5)
|
|
50
|
+
connection_pool (2.5.0)
|
|
104
51
|
diff-lcs (1.5.1)
|
|
105
52
|
docile (1.4.1)
|
|
106
53
|
drb (2.2.1)
|
|
107
|
-
erubi (1.13.0)
|
|
108
54
|
globalid (1.2.1)
|
|
109
55
|
activesupport (>= 6.1)
|
|
110
|
-
i18n (1.14.
|
|
56
|
+
i18n (1.14.7)
|
|
111
57
|
concurrent-ruby (~> 1.0)
|
|
112
|
-
io-console (0.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
reline (>= 0.4.2)
|
|
116
|
-
json (2.7.2)
|
|
117
|
-
kicks (3.1.0)
|
|
58
|
+
io-console (0.8.0)
|
|
59
|
+
json (2.10.0)
|
|
60
|
+
kicks (3.2.0)
|
|
118
61
|
bunny (~> 2.19)
|
|
119
62
|
concurrent-ruby (~> 1.0)
|
|
120
63
|
rake (>= 12.3, < 14.0)
|
|
121
64
|
serverengine (~> 2.1)
|
|
122
65
|
thor
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
language_server-protocol (3.17.0.3)
|
|
126
|
-
logger (1.6.1)
|
|
127
|
-
loofah (2.23.1)
|
|
128
|
-
crass (~> 1.0.2)
|
|
129
|
-
nokogiri (>= 1.12.0)
|
|
130
|
-
mail (2.8.1)
|
|
131
|
-
mini_mime (>= 0.1.1)
|
|
132
|
-
net-imap
|
|
133
|
-
net-pop
|
|
134
|
-
net-smtp
|
|
135
|
-
marcel (1.0.4)
|
|
66
|
+
language_server-protocol (3.17.0.4)
|
|
67
|
+
logger (1.6.5)
|
|
136
68
|
method_source (1.1.0)
|
|
137
|
-
|
|
138
|
-
mini_portile2 (2.8.8)
|
|
139
|
-
minitest (5.25.1)
|
|
140
|
-
mutex_m (0.2.0)
|
|
141
|
-
net-imap (0.4.17)
|
|
142
|
-
date
|
|
143
|
-
net-protocol
|
|
144
|
-
net-pop (0.1.2)
|
|
145
|
-
net-protocol
|
|
146
|
-
net-protocol (0.2.2)
|
|
147
|
-
timeout
|
|
148
|
-
net-smtp (0.5.0)
|
|
149
|
-
net-protocol
|
|
150
|
-
nio4r (2.7.3)
|
|
151
|
-
nokogiri (1.16.8)
|
|
152
|
-
mini_portile2 (~> 2.8.2)
|
|
153
|
-
racc (~> 1.4)
|
|
69
|
+
minitest (5.25.4)
|
|
154
70
|
parallel (1.26.3)
|
|
155
|
-
parser (3.3.
|
|
71
|
+
parser (3.3.7.1)
|
|
156
72
|
ast (~> 2.4.1)
|
|
157
73
|
racc
|
|
158
|
-
pry (0.
|
|
74
|
+
pry (0.15.2)
|
|
159
75
|
coderay (~> 1.1)
|
|
160
76
|
method_source (~> 1.0)
|
|
161
|
-
psych (5.1.2)
|
|
162
|
-
stringio
|
|
163
77
|
racc (1.8.1)
|
|
164
|
-
rack (3.1.
|
|
165
|
-
rack-session (2.0.0)
|
|
166
|
-
rack (>= 3.0.0)
|
|
167
|
-
rack-test (2.1.0)
|
|
168
|
-
rack (>= 1.3)
|
|
169
|
-
rackup (2.1.0)
|
|
170
|
-
rack (>= 3)
|
|
171
|
-
webrick (~> 1.8)
|
|
172
|
-
rails (7.1.4.1)
|
|
173
|
-
actioncable (= 7.1.4.1)
|
|
174
|
-
actionmailbox (= 7.1.4.1)
|
|
175
|
-
actionmailer (= 7.1.4.1)
|
|
176
|
-
actionpack (= 7.1.4.1)
|
|
177
|
-
actiontext (= 7.1.4.1)
|
|
178
|
-
actionview (= 7.1.4.1)
|
|
179
|
-
activejob (= 7.1.4.1)
|
|
180
|
-
activemodel (= 7.1.4.1)
|
|
181
|
-
activerecord (= 7.1.4.1)
|
|
182
|
-
activestorage (= 7.1.4.1)
|
|
183
|
-
activesupport (= 7.1.4.1)
|
|
184
|
-
bundler (>= 1.15.0)
|
|
185
|
-
railties (= 7.1.4.1)
|
|
186
|
-
rails-dom-testing (2.2.0)
|
|
187
|
-
activesupport (>= 5.0.0)
|
|
188
|
-
minitest
|
|
189
|
-
nokogiri (>= 1.6)
|
|
190
|
-
rails-html-sanitizer (1.6.1)
|
|
191
|
-
loofah (~> 2.21)
|
|
192
|
-
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
193
|
-
railties (7.1.4.1)
|
|
194
|
-
actionpack (= 7.1.4.1)
|
|
195
|
-
activesupport (= 7.1.4.1)
|
|
196
|
-
irb
|
|
197
|
-
rackup (>= 1.0.0)
|
|
198
|
-
rake (>= 12.2)
|
|
199
|
-
thor (~> 1.0, >= 1.2.2)
|
|
200
|
-
zeitwerk (~> 2.6)
|
|
78
|
+
rack (3.1.9)
|
|
201
79
|
rainbow (3.1.1)
|
|
202
80
|
rake (13.2.1)
|
|
203
81
|
rbtree (0.4.6)
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
regexp_parser (2.9.2)
|
|
207
|
-
reline (0.5.10)
|
|
82
|
+
regexp_parser (2.10.0)
|
|
83
|
+
reline (0.6.0)
|
|
208
84
|
io-console (~> 0.5)
|
|
209
85
|
rspec (3.13.0)
|
|
210
86
|
rspec-core (~> 3.13.0)
|
|
211
87
|
rspec-expectations (~> 3.13.0)
|
|
212
88
|
rspec-mocks (~> 3.13.0)
|
|
213
|
-
rspec-core (3.13.
|
|
89
|
+
rspec-core (3.13.3)
|
|
214
90
|
rspec-support (~> 3.13.0)
|
|
215
91
|
rspec-expectations (3.13.3)
|
|
216
92
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
217
93
|
rspec-support (~> 3.13.0)
|
|
218
|
-
rspec-its (
|
|
219
|
-
rspec-core (>= 3.
|
|
220
|
-
rspec-expectations (>= 3.
|
|
94
|
+
rspec-its (2.0.0)
|
|
95
|
+
rspec-core (>= 3.13.0)
|
|
96
|
+
rspec-expectations (>= 3.13.0)
|
|
221
97
|
rspec-mocks (3.13.2)
|
|
222
98
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
223
99
|
rspec-support (~> 3.13.0)
|
|
224
|
-
rspec-support (3.13.
|
|
225
|
-
rubocop (1.
|
|
100
|
+
rspec-support (3.13.2)
|
|
101
|
+
rubocop (1.69.2)
|
|
226
102
|
json (~> 2.3)
|
|
227
103
|
language_server-protocol (>= 3.17.0)
|
|
228
104
|
parallel (~> 1.10)
|
|
229
105
|
parser (>= 3.3.0.2)
|
|
230
106
|
rainbow (>= 2.2.2, < 4.0)
|
|
231
|
-
regexp_parser (>= 2.
|
|
232
|
-
rubocop-ast (>= 1.
|
|
107
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
108
|
+
rubocop-ast (>= 1.36.2, < 2.0)
|
|
233
109
|
ruby-progressbar (~> 1.7)
|
|
234
|
-
unicode-display_width (>= 2.4.0, <
|
|
235
|
-
rubocop-ast (1.
|
|
110
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
111
|
+
rubocop-ast (1.38.0)
|
|
236
112
|
parser (>= 3.3.1.0)
|
|
237
|
-
rubocop-config-umbrellio (1.
|
|
238
|
-
rubocop (~> 1.
|
|
113
|
+
rubocop-config-umbrellio (1.69.0.101)
|
|
114
|
+
rubocop (~> 1.69.0)
|
|
239
115
|
rubocop-factory_bot (~> 2.26.0)
|
|
240
|
-
rubocop-performance (~> 1.
|
|
241
|
-
rubocop-rails (~> 2.
|
|
116
|
+
rubocop-performance (~> 1.23.0)
|
|
117
|
+
rubocop-rails (~> 2.28.0)
|
|
242
118
|
rubocop-rake (~> 0.6.0)
|
|
243
|
-
rubocop-rspec (~> 3.
|
|
244
|
-
rubocop-sequel (~> 0.3.
|
|
119
|
+
rubocop-rspec (~> 3.3.0)
|
|
120
|
+
rubocop-sequel (~> 0.3.0)
|
|
245
121
|
rubocop-factory_bot (2.26.1)
|
|
246
122
|
rubocop (~> 1.61)
|
|
247
|
-
rubocop-performance (1.
|
|
123
|
+
rubocop-performance (1.23.1)
|
|
248
124
|
rubocop (>= 1.48.1, < 2.0)
|
|
249
125
|
rubocop-ast (>= 1.31.1, < 2.0)
|
|
250
|
-
rubocop-rails (2.
|
|
126
|
+
rubocop-rails (2.28.0)
|
|
251
127
|
activesupport (>= 4.2.0)
|
|
252
128
|
rack (>= 1.1)
|
|
253
129
|
rubocop (>= 1.52.0, < 2.0)
|
|
254
130
|
rubocop-ast (>= 1.31.1, < 2.0)
|
|
255
131
|
rubocop-rake (0.6.0)
|
|
256
132
|
rubocop (~> 1.0)
|
|
257
|
-
rubocop-rspec (3.0
|
|
133
|
+
rubocop-rspec (3.3.0)
|
|
258
134
|
rubocop (~> 1.61)
|
|
259
|
-
rubocop-sequel (0.3.
|
|
135
|
+
rubocop-sequel (0.3.8)
|
|
260
136
|
rubocop (~> 1.0)
|
|
261
137
|
ruby-progressbar (1.13.0)
|
|
138
|
+
securerandom (0.4.1)
|
|
262
139
|
serverengine (2.4.0)
|
|
263
140
|
base64 (~> 0.1)
|
|
264
141
|
logger (~> 1.4)
|
|
265
142
|
sigdump (~> 0.2.2)
|
|
266
|
-
set (1.1.
|
|
143
|
+
set (1.1.1)
|
|
267
144
|
sigdump (0.2.5)
|
|
268
145
|
simplecov (0.22.0)
|
|
269
146
|
docile (~> 1.1)
|
|
@@ -275,35 +152,32 @@ GEM
|
|
|
275
152
|
sorted_set (1.0.3)
|
|
276
153
|
rbtree
|
|
277
154
|
set (~> 1.0)
|
|
278
|
-
stringio (3.1.1)
|
|
279
155
|
tainbox (2.1.2)
|
|
280
156
|
activesupport
|
|
281
157
|
thor (1.3.2)
|
|
282
|
-
timeout (0.4.
|
|
158
|
+
timeout (0.4.3)
|
|
283
159
|
tzinfo (2.0.6)
|
|
284
160
|
concurrent-ruby (~> 1.0)
|
|
285
|
-
unicode-display_width (
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
websocket-extensions (>= 0.1.0)
|
|
289
|
-
websocket-extensions (0.1.5)
|
|
290
|
-
zeitwerk (2.6.18)
|
|
161
|
+
unicode-display_width (3.1.4)
|
|
162
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
|
163
|
+
unicode-emoji (4.0.4)
|
|
291
164
|
|
|
292
165
|
PLATFORMS
|
|
166
|
+
arm64-darwin
|
|
293
167
|
ruby
|
|
294
168
|
|
|
295
169
|
DEPENDENCIES
|
|
296
|
-
|
|
297
|
-
|
|
170
|
+
activejob
|
|
171
|
+
activerecord
|
|
298
172
|
pry
|
|
299
173
|
rabbit_messaging!
|
|
300
|
-
|
|
301
|
-
rake
|
|
174
|
+
reline
|
|
302
175
|
rspec
|
|
303
176
|
rspec-its
|
|
304
177
|
rubocop-config-umbrellio
|
|
305
178
|
simplecov
|
|
306
179
|
simplecov-lcov
|
|
180
|
+
sneakers_handlers!
|
|
307
181
|
|
|
308
182
|
BUNDLED WITH
|
|
309
|
-
2.
|
|
183
|
+
2.6.3
|
data/README.md
CHANGED
|
@@ -33,38 +33,42 @@ require "rabbit_messaging"
|
|
|
33
33
|
|
|
34
34
|
- `Rabbit.config` provides setters for following options:
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
- `group_id` (`Symbol`), *required*
|
|
37
37
|
|
|
38
38
|
Shared identifier which used to select api. As usual, it should be same as default project_id
|
|
39
39
|
(I.e. we have project 'support', which runs only one application in production.
|
|
40
40
|
So on, it's group_id should be :support)
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
- `project_id` (`Symbol`), *required*
|
|
43
43
|
|
|
44
44
|
Personal identifier which used to select exact service.
|
|
45
45
|
As usual, it should be same as default project_id with optional stage_id.
|
|
46
46
|
(I.e. we have project 'support', in production it's project_id is :support,
|
|
47
47
|
but in staging it uses :support1 and :support2 ids for corresponding stages)
|
|
48
48
|
|
|
49
|
+
- `queue_suffix` (`String`)
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
Optional suffix added to the read queue name. For example, in case of `group_id = "grp"`, `project_id = "prj"` and
|
|
52
|
+
`queue_suffix = "sfx"`, Rabbit will read from queue named `"grp.prj.sfx"`.
|
|
53
|
+
|
|
54
|
+
- `exception_notifier` (`Proc`)
|
|
51
55
|
You must provide your own notifier like this to notify about exceptions:
|
|
52
|
-
|
|
56
|
+
|
|
53
57
|
```ruby
|
|
54
58
|
config.exception_notifier = proc { |e| MyCoolNotifier.notify!(e) }
|
|
55
59
|
```
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
- `hooks` (`Hash`)
|
|
58
62
|
|
|
59
63
|
:before_fork and :after_fork hooks, used same way as in unicorn / puma / que / etc
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
- `environment` (one of `:test`, `:development`, `:production`), *default:- `:production`
|
|
62
66
|
|
|
63
67
|
Internal environment of gem.
|
|
64
68
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
- `:test` environment stubs publishing and does not suppress errors
|
|
70
|
+
- `:development` environment auto-creates queues and uses default exchange
|
|
71
|
+
- `:production` environment enables handlers caching and gets maximum strictness
|
|
68
72
|
|
|
69
73
|
By default gem skips publishing in test and development environments.
|
|
70
74
|
If you want to change that then manually set `Rabbit.skip_publishing_in` with an array of environments.
|
|
@@ -73,13 +77,13 @@ require "rabbit_messaging"
|
|
|
73
77
|
Rabbit.skip_publishing_in = %i[test]
|
|
74
78
|
```
|
|
75
79
|
|
|
76
|
-
|
|
80
|
+
- `receiving_job_class_callable` (`Proc`)
|
|
77
81
|
|
|
78
82
|
Custom ActiveJob subclass to work with received messages. Receives the following attributes as `kwarg`-arguments:
|
|
79
83
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
- `:arguments` - information about message type (`type`), application id (`app_id`), message id (`message_id`);
|
|
85
|
+
- `:delivery_info` - information about `exchange`, `routing_key`, etc;
|
|
86
|
+
- `:message` - received RabbitMQ message (often in a `string` format);
|
|
83
87
|
|
|
84
88
|
```ruby
|
|
85
89
|
{
|
|
@@ -93,7 +97,7 @@ require "rabbit_messaging"
|
|
|
93
97
|
}
|
|
94
98
|
```
|
|
95
99
|
|
|
96
|
-
|
|
100
|
+
- `before_receiving_hooks, after_receiving_hooks` (`Array of Procs`)
|
|
97
101
|
|
|
98
102
|
Before and after hooks with message processing in the middle. Where `before_receiving_hooks` and `after_receiving_hooks` are empty arrays by default.
|
|
99
103
|
|
|
@@ -107,8 +111,22 @@ require "rabbit_messaging"
|
|
|
107
111
|
|
|
108
112
|
config.after_receiving_hooks.append(proc { |message, arguments| do_stuff_3 })
|
|
109
113
|
config.after_receiving_hooks.append(proc { |message, arguments| do_stuff_4 })
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
- `use_backoff_handler` (`Boolean`)
|
|
117
|
+
|
|
118
|
+
If set to `true`, use `ExponentialBackoffHandler`. You will also need add the following line to your Gemfile:
|
|
110
119
|
|
|
120
|
+
```ruby
|
|
121
|
+
gem "sneakers_handlers", github: "umbrellio/sneakers_handlers"
|
|
111
122
|
```
|
|
123
|
+
|
|
124
|
+
See https://github.com/umbrellio/sneakers_handlers for more details.
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
- `backoff_handler_max_retries` (`Integer`)
|
|
128
|
+
|
|
129
|
+
Number of retries that `ExponentialBackoffHandler` will use before sending job to the error queue. 5 by default.
|
|
112
130
|
---
|
|
113
131
|
|
|
114
132
|
### Client
|
|
@@ -127,16 +145,16 @@ Rabbit.publish(
|
|
|
127
145
|
|
|
128
146
|
- This code sends messages via basic_publish with following parameters:
|
|
129
147
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
148
|
+
- `routing_key`: `"support"`
|
|
149
|
+
- `exchange`: `"group_id.project_id.fanout"` (default is `"group_id.poject_id"`)
|
|
150
|
+
- `mandatory`: `true` (same as confirm_select)
|
|
133
151
|
|
|
134
152
|
It is set to raise error if routing failed
|
|
135
153
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
154
|
+
- `persistent`: `true`
|
|
155
|
+
- `type`: `"ping"`
|
|
156
|
+
- `content_type`: `"application/json"` (always)
|
|
157
|
+
- `app_id`: `"group_id.project_id"`
|
|
140
158
|
|
|
141
159
|
- Messages are logged to `/log/rabbit.log`
|
|
142
160
|
|
data/Rakefile
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "bundler/gem_tasks"
|
|
4
|
-
require "bundler/audit/task"
|
|
5
4
|
require "rspec/core/rake_task"
|
|
6
5
|
require "rubocop"
|
|
7
6
|
require "rubocop-rspec"
|
|
@@ -17,6 +16,5 @@ RuboCop::RakeTask.new(:rubocop) do |t|
|
|
|
17
16
|
end
|
|
18
17
|
|
|
19
18
|
RSpec::Core::RakeTask.new(:rspec)
|
|
20
|
-
Bundler::Audit::Task.new
|
|
21
19
|
|
|
22
20
|
task default: :rspec
|
data/bin/console
CHANGED
data/config/sneakers.yml
ADDED
data/environments/development.rb
CHANGED
|
@@ -6,12 +6,8 @@ Bundler.require(:default, :development)
|
|
|
6
6
|
require "active_job"
|
|
7
7
|
require "active_record"
|
|
8
8
|
|
|
9
|
-
def Rails.root
|
|
10
|
-
Pathname.new(__dir__).join("..")
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
ActiveJob::Base.queue_adapter = :inline
|
|
14
|
-
ActiveJob::Base.logger = Logger.new(
|
|
10
|
+
ActiveJob::Base.logger = Logger.new(nil)
|
|
15
11
|
|
|
16
12
|
Rabbit.config.project_id = "test_project_id"
|
|
17
13
|
Rabbit.config.group_id = "test_group_id"
|
data/lib/rabbit/daemon.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "sneakers"
|
|
4
|
-
require "lamian"
|
|
5
4
|
require "sneakers/runner"
|
|
6
5
|
|
|
7
6
|
require "rabbit/extensions/bunny/channel"
|
|
@@ -12,35 +11,38 @@ module Rabbit
|
|
|
12
11
|
extend self
|
|
13
12
|
|
|
14
13
|
def run(logger: Sneakers.logger)
|
|
15
|
-
|
|
16
|
-
logger = Logger.new(Rails.root.join("log", "sneakers.log"))
|
|
17
|
-
logger.level = Logger::DEBUG
|
|
18
|
-
Lamian.extend_logger(logger)
|
|
19
|
-
end
|
|
14
|
+
self.logger = logger
|
|
20
15
|
|
|
21
16
|
Sneakers.configure(**sneakers_config(logger: logger))
|
|
22
17
|
Sneakers.server = true
|
|
23
18
|
|
|
24
19
|
Rabbit.config.validate!
|
|
25
|
-
|
|
20
|
+
|
|
21
|
+
Receiving::Worker.from_queue(Rabbit.config.read_queue, **worker_options)
|
|
26
22
|
Sneakers::Runner.new([Receiving::Worker]).run
|
|
27
23
|
end
|
|
28
24
|
|
|
29
25
|
def config
|
|
30
|
-
|
|
26
|
+
@config ||= Rabbit.sneakers_config
|
|
31
27
|
end
|
|
32
28
|
|
|
33
29
|
def connection
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
@connection ||= begin
|
|
31
|
+
bunny_config = config.delete(:bunny_options).to_h.symbolize_keys
|
|
32
|
+
bunny_logger = logger.dup
|
|
33
|
+
bunny_logger.level = bunny_config.delete(:log_level) || :info
|
|
34
|
+
Bunny.new(**bunny_config, logger: bunny_logger)
|
|
35
|
+
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
private
|
|
39
39
|
|
|
40
|
+
attr_accessor :logger
|
|
41
|
+
|
|
40
42
|
def sneakers_config(logger:)
|
|
41
43
|
{
|
|
42
44
|
connection: connection,
|
|
43
|
-
env:
|
|
45
|
+
env: Rabbit.config.environment,
|
|
44
46
|
exchange_type: :direct,
|
|
45
47
|
exchange: Rabbit.config.app_name,
|
|
46
48
|
hooks: Rabbit.config.hooks,
|
|
@@ -51,5 +53,20 @@ module Rabbit
|
|
|
51
53
|
**config,
|
|
52
54
|
}
|
|
53
55
|
end
|
|
56
|
+
|
|
57
|
+
def worker_options
|
|
58
|
+
return {} unless Rabbit.config.use_backoff_handler
|
|
59
|
+
|
|
60
|
+
require "sneakers_handlers"
|
|
61
|
+
|
|
62
|
+
{
|
|
63
|
+
handler: SneakersHandlers::ExponentialBackoffHandler,
|
|
64
|
+
max_retries: Rabbit.config.backoff_handler_max_retries,
|
|
65
|
+
arguments: {
|
|
66
|
+
"x-dead-letter-exchange" => "#{Rabbit.config.read_queue}.dlx",
|
|
67
|
+
"x-dead-letter-routing-key" => "#{Rabbit.config.read_queue}.dlx",
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
end
|
|
54
71
|
end
|
|
55
72
|
end
|
data/lib/rabbit/publishing.rb
CHANGED
|
@@ -40,8 +40,8 @@ module Rabbit
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def create_client
|
|
43
|
-
config =
|
|
44
|
-
config = config[
|
|
43
|
+
config = Rabbit.sneakers_config
|
|
44
|
+
config = config[:bunny_options].to_h.symbolize_keys
|
|
45
45
|
|
|
46
46
|
Bunny.new(config).start
|
|
47
47
|
end
|
|
@@ -50,11 +50,11 @@ module Rabbit
|
|
|
50
50
|
@logger ||= Rabbit.config.publish_logger
|
|
51
51
|
|
|
52
52
|
metadata = [
|
|
53
|
-
message.real_exchange_name, message.routing_key, message.headers,
|
|
53
|
+
message.real_exchange_name, message.routing_key, JSON.dump(message.headers),
|
|
54
54
|
message.event, message.confirm_select? ? "confirm" : "no-confirm"
|
|
55
55
|
]
|
|
56
56
|
|
|
57
|
-
@logger.debug "#{metadata.join ' / '}: #{message.data}"
|
|
57
|
+
@logger.debug "#{metadata.join ' / '}: #{JSON.dump(message.data)}"
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
end
|
data/lib/rabbit/receiving/job.rb
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "lamian"
|
|
4
|
-
require "active_job"
|
|
5
|
-
|
|
6
3
|
require "rabbit"
|
|
7
4
|
require "rabbit/receiving"
|
|
8
5
|
require "rabbit/receiving/message"
|
|
9
6
|
require "rabbit/receiving/handler_resolver"
|
|
10
7
|
require "rabbit/receiving/malformed_message"
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
begin
|
|
10
|
+
require "active_job"
|
|
11
|
+
|
|
12
|
+
class Rabbit::Receiving::Job < ActiveJob::Base
|
|
13
|
+
def perform(message, arguments)
|
|
15
14
|
message = Rabbit::Receiving::Message.build(message, arguments)
|
|
16
15
|
handler = Rabbit::Receiving::HandlerResolver.handler_for(message)
|
|
17
16
|
handler.new(message).call
|
|
@@ -20,4 +19,6 @@ class Rabbit::Receiving::Job < ActiveJob::Base
|
|
|
20
19
|
Rabbit.config.exception_notifier.call(error)
|
|
21
20
|
end
|
|
22
21
|
end
|
|
22
|
+
rescue LoadError
|
|
23
|
+
warn "ActiveJob not found! You will need to define Rabbit::Receiving::Job class by yourself."
|
|
23
24
|
end
|
data/lib/rabbit/version.rb
CHANGED
data/lib/rabbit.rb
CHANGED
|
@@ -16,10 +16,11 @@ module Rabbit
|
|
|
16
16
|
class Config
|
|
17
17
|
include Tainbox
|
|
18
18
|
|
|
19
|
-
attribute :group_id, Symbol
|
|
20
|
-
attribute :project_id, Symbol
|
|
19
|
+
attribute :group_id, :Symbol
|
|
20
|
+
attribute :project_id, :Symbol
|
|
21
|
+
attribute :queue_suffix, :String
|
|
21
22
|
attribute :hooks, default: {}
|
|
22
|
-
attribute :environment, Symbol, default: :production
|
|
23
|
+
attribute :environment, :Symbol, default: :production
|
|
23
24
|
attribute :queue_name_conversion
|
|
24
25
|
attribute :receiving_job_class_callable
|
|
25
26
|
attribute :handler_resolver_callable
|
|
@@ -27,17 +28,19 @@ module Rabbit
|
|
|
27
28
|
attribute :before_receiving_hooks, default: []
|
|
28
29
|
attribute :after_receiving_hooks, default: []
|
|
29
30
|
attribute :skip_publishing_in, default: %i[test development]
|
|
31
|
+
attribute :use_backoff_handler, :Boolean, default: false
|
|
32
|
+
attribute :backoff_handler_max_retries, Integer, default: 6
|
|
30
33
|
|
|
31
34
|
attribute :receive_logger, default: lambda {
|
|
32
|
-
Logger.new(
|
|
35
|
+
Logger.new(Rabbit.root.join("log", "incoming_rabbit_messages.log"))
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
attribute :publish_logger, default: lambda {
|
|
36
|
-
Logger.new(
|
|
39
|
+
Logger.new(Rabbit.root.join("log", "rabbit.log"))
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
attribute :malformed_logger, default: lambda {
|
|
40
|
-
Logger.new(
|
|
43
|
+
Logger.new(Rabbit.root.join("log", "malformed_messages.log"))
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
def validate!
|
|
@@ -45,7 +48,7 @@ module Rabbit
|
|
|
45
48
|
raise InvalidConfig, "missing group_id" unless group_id
|
|
46
49
|
raise InvalidConfig, "missing exception_notifier" unless exception_notifier
|
|
47
50
|
|
|
48
|
-
unless
|
|
51
|
+
unless %i[test development production].include?(environment)
|
|
49
52
|
raise "environment should be one of (test, development, production)"
|
|
50
53
|
end
|
|
51
54
|
end
|
|
@@ -58,7 +61,9 @@ module Rabbit
|
|
|
58
61
|
[group_id, project_id].join(".")
|
|
59
62
|
end
|
|
60
63
|
|
|
61
|
-
|
|
64
|
+
def read_queue
|
|
65
|
+
[app_name, queue_suffix].reject { |x| x.nil? || x.empty? }.join(".")
|
|
66
|
+
end
|
|
62
67
|
end
|
|
63
68
|
|
|
64
69
|
extend self
|
|
@@ -69,6 +74,23 @@ module Rabbit
|
|
|
69
74
|
@config
|
|
70
75
|
end
|
|
71
76
|
|
|
77
|
+
def root
|
|
78
|
+
if defined?(Rails)
|
|
79
|
+
Rails.root
|
|
80
|
+
else
|
|
81
|
+
Pathname.new(Dir.pwd)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def sneakers_config
|
|
86
|
+
if defined?(Rails)
|
|
87
|
+
Rails.application.config_for("sneakers")
|
|
88
|
+
else
|
|
89
|
+
config = YAML.load_file("config/sneakers.yml", aliases: true)
|
|
90
|
+
config[Rabbit.config.environment.to_s].to_h.symbolize_keys
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
72
94
|
def configure
|
|
73
95
|
yield(config)
|
|
74
96
|
config.validate!
|
data/rabbit_messaging.gemspec
CHANGED
|
@@ -20,8 +20,6 @@ Gem::Specification.new do |spec|
|
|
|
20
20
|
spec.require_paths = ["lib"]
|
|
21
21
|
|
|
22
22
|
spec.add_dependency "bunny", "~> 2.0"
|
|
23
|
-
spec.add_dependency "kicks"
|
|
24
|
-
spec.add_dependency "lamian"
|
|
25
|
-
spec.add_dependency "rails", ">= 6.1"
|
|
23
|
+
spec.add_dependency "kicks"
|
|
26
24
|
spec.add_dependency "tainbox"
|
|
27
25
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rabbit_messaging
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Umbrellio
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2025-02-11 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: bunny
|
|
@@ -26,20 +25,6 @@ dependencies:
|
|
|
26
25
|
version: '2.0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
27
|
name: kicks
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '3'
|
|
34
|
-
type: :runtime
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - "~>"
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '3'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: lamian
|
|
43
28
|
requirement: !ruby/object:Gem::Requirement
|
|
44
29
|
requirements:
|
|
45
30
|
- - ">="
|
|
@@ -52,20 +37,6 @@ dependencies:
|
|
|
52
37
|
- - ">="
|
|
53
38
|
- !ruby/object:Gem::Version
|
|
54
39
|
version: '0'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: rails
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - ">="
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '6.1'
|
|
62
|
-
type: :runtime
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - ">="
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: '6.1'
|
|
69
40
|
- !ruby/object:Gem::Dependency
|
|
70
41
|
name: tainbox
|
|
71
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -99,6 +70,7 @@ files:
|
|
|
99
70
|
- Rakefile
|
|
100
71
|
- bin/console
|
|
101
72
|
- bin/setup
|
|
73
|
+
- config/sneakers.yml
|
|
102
74
|
- environments/development.rb
|
|
103
75
|
- lib/rabbit.rb
|
|
104
76
|
- lib/rabbit/daemon.rb
|
|
@@ -124,7 +96,6 @@ files:
|
|
|
124
96
|
homepage: https://github.com/umbrellio/rabbit_messaging
|
|
125
97
|
licenses: []
|
|
126
98
|
metadata: {}
|
|
127
|
-
post_install_message:
|
|
128
99
|
rdoc_options: []
|
|
129
100
|
require_paths:
|
|
130
101
|
- lib
|
|
@@ -139,8 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
139
110
|
- !ruby/object:Gem::Version
|
|
140
111
|
version: '0'
|
|
141
112
|
requirements: []
|
|
142
|
-
rubygems_version: 3.
|
|
143
|
-
signing_key:
|
|
113
|
+
rubygems_version: 3.6.3
|
|
144
114
|
specification_version: 4
|
|
145
115
|
summary: Rabbit (Rabbit Messaging)
|
|
146
116
|
test_files: []
|