bbk-amqp 1.1.0.204853 → 1.1.1.273342
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +61 -29
- data/lib/bbk/amqp/consumer.rb +2 -2
- data/lib/bbk/amqp/message.rb +8 -19
- data/lib/bbk/amqp/rejection_policies/reject.rb +4 -3
- data/lib/bbk/amqp/rejection_policies/republish.rb +1 -1
- data/lib/bbk/amqp/rejection_policies/requeue.rb +3 -1
- data/lib/bbk/amqp/version.rb +1 -1
- metadata +35 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90ec5e4b546468b79eac4d67b12f2c371fd6469bd89e2a92ad12d1a11acc358e
|
4
|
+
data.tar.gz: c363a4a337a533af390f39de968dd622e852a3ee8378554aa23802226582d0c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a174978472b0f091a7555144692c2c89f2e6ab16d3ca225597cba5dca259e4498a3f8d817af44b61af510c6427809d3fd6f65bb0576a0fa0eafd2ae47cb28b7
|
7
|
+
data.tar.gz: 90195f6966cead2909528e563d2f1e1140bdb284fa9ee892ff351c45780b12ce8f553d16c9b2cf63caf6029f40e4db81870dc6ba3c1d8aa88b153676e1d3e2e4
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bbk-amqp (1.1.
|
4
|
+
bbk-amqp (1.1.1.273342)
|
5
5
|
activesupport (>= 6.0)
|
6
|
+
bbk-app (>= 1.1.1.273338)
|
6
7
|
bbk-utils (> 1.0.1)
|
7
8
|
bunny (>= 2.19.0)
|
8
9
|
oj
|
@@ -10,12 +11,19 @@ PATH
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
12
13
|
specs:
|
13
|
-
activesupport (
|
14
|
+
activesupport (7.1.5)
|
15
|
+
base64
|
16
|
+
benchmark (>= 0.3)
|
17
|
+
bigdecimal
|
14
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
|
+
connection_pool (>= 2.2.5)
|
20
|
+
drb
|
15
21
|
i18n (>= 1.6, < 2)
|
22
|
+
logger (>= 1.4.2)
|
16
23
|
minitest (>= 5.1)
|
24
|
+
mutex_m
|
25
|
+
securerandom (>= 0.3)
|
17
26
|
tzinfo (~> 2.0)
|
18
|
-
zeitwerk (~> 2.3)
|
19
27
|
addressable (2.8.0)
|
20
28
|
public_suffix (>= 2.0.2, < 5.0)
|
21
29
|
amq-protocol (2.3.2)
|
@@ -25,14 +33,17 @@ GEM
|
|
25
33
|
descendants_tracker (~> 0.0.4)
|
26
34
|
ice_nine (~> 0.11.0)
|
27
35
|
thread_safe (~> 0.3, >= 0.3.1)
|
28
|
-
|
29
|
-
|
36
|
+
base64 (0.2.0)
|
37
|
+
bbk-app (1.1.1.273338)
|
38
|
+
activesupport (>= 6.0)
|
30
39
|
bbk-utils (> 1.0.1)
|
40
|
+
oj
|
31
41
|
timeouter
|
32
|
-
bbk-utils (1.0.
|
33
|
-
activesupport (
|
42
|
+
bbk-utils (1.1.0.273317)
|
43
|
+
activesupport (>= 7.0)
|
34
44
|
russian
|
35
|
-
|
45
|
+
benchmark (0.4.0)
|
46
|
+
bigdecimal (3.1.8)
|
36
47
|
bunny (2.19.0)
|
37
48
|
amq-protocol (~> 2.3, >= 2.3.1)
|
38
49
|
sorted_set (~> 1, >= 1.0.2)
|
@@ -41,11 +52,13 @@ GEM
|
|
41
52
|
byebug (11.1.3)
|
42
53
|
coercible (1.0.0)
|
43
54
|
descendants_tracker (~> 0.0.1)
|
44
|
-
concurrent-ruby (1.
|
55
|
+
concurrent-ruby (1.3.4)
|
56
|
+
connection_pool (2.4.1)
|
45
57
|
descendants_tracker (0.0.4)
|
46
58
|
thread_safe (~> 0.3, >= 0.3.1)
|
47
|
-
diff-lcs (1.5.
|
59
|
+
diff-lcs (1.5.1)
|
48
60
|
docile (1.4.0)
|
61
|
+
drb (2.2.1)
|
49
62
|
equalizer (0.0.11)
|
50
63
|
erubis (2.7.0)
|
51
64
|
flay (2.12.1)
|
@@ -57,41 +70,60 @@ GEM
|
|
57
70
|
path_expander (~> 1.0)
|
58
71
|
ruby_parser (~> 3.1, > 3.1.0)
|
59
72
|
sexp_processor (~> 4.8)
|
60
|
-
i18n (1.
|
73
|
+
i18n (1.14.6)
|
61
74
|
concurrent-ruby (~> 1.0)
|
62
75
|
ice_nine (0.11.2)
|
63
76
|
kwalify (0.7.2)
|
64
77
|
launchy (2.5.0)
|
65
78
|
addressable (~> 2.7)
|
66
|
-
|
67
|
-
|
79
|
+
logger (1.6.1)
|
80
|
+
minitest (5.25.1)
|
81
|
+
mutex_m (0.2.0)
|
82
|
+
oj (3.16.7)
|
68
83
|
bigdecimal (>= 3.0)
|
84
|
+
ostruct (>= 0.2)
|
85
|
+
ostruct (0.6.1)
|
86
|
+
parallel (1.26.3)
|
69
87
|
parser (3.0.3.2)
|
70
88
|
ast (~> 2.4.1)
|
71
89
|
path_expander (1.1.0)
|
72
90
|
public_suffix (4.0.6)
|
73
91
|
rainbow (3.1.1)
|
74
92
|
rake (13.0.6)
|
75
|
-
rbtree (0.4.
|
93
|
+
rbtree (0.4.6)
|
76
94
|
reek (6.0.6)
|
77
95
|
kwalify (~> 0.7.0)
|
78
96
|
parser (~> 3.0.0)
|
79
97
|
rainbow (>= 2.0, < 4.0)
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
rspec-
|
84
|
-
|
85
|
-
rspec-
|
86
|
-
rspec-
|
98
|
+
regexp_parser (2.9.2)
|
99
|
+
rexml (3.3.9)
|
100
|
+
rspec (3.13.0)
|
101
|
+
rspec-core (~> 3.13.0)
|
102
|
+
rspec-expectations (~> 3.13.0)
|
103
|
+
rspec-mocks (~> 3.13.0)
|
104
|
+
rspec-core (3.13.2)
|
105
|
+
rspec-support (~> 3.13.0)
|
106
|
+
rspec-expectations (3.13.3)
|
87
107
|
diff-lcs (>= 1.2.0, < 2.0)
|
88
|
-
rspec-support (~> 3.
|
89
|
-
rspec-mocks (3.
|
108
|
+
rspec-support (~> 3.13.0)
|
109
|
+
rspec-mocks (3.13.2)
|
90
110
|
diff-lcs (>= 1.2.0, < 2.0)
|
91
|
-
rspec-support (~> 3.
|
92
|
-
rspec-support (3.
|
111
|
+
rspec-support (~> 3.13.0)
|
112
|
+
rspec-support (3.13.1)
|
93
113
|
rspec_junit_formatter (0.5.1)
|
94
114
|
rspec-core (>= 2, < 4, != 2.12.0)
|
115
|
+
rubocop (1.24.1)
|
116
|
+
parallel (~> 1.10)
|
117
|
+
parser (>= 3.0.0.0)
|
118
|
+
rainbow (>= 2.2.2, < 4.0)
|
119
|
+
regexp_parser (>= 1.8, < 3.0)
|
120
|
+
rexml
|
121
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
122
|
+
ruby-progressbar (~> 1.7)
|
123
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
124
|
+
rubocop-ast (1.15.2)
|
125
|
+
parser (>= 3.0.1.1)
|
126
|
+
ruby-progressbar (1.13.0)
|
95
127
|
ruby_parser (3.18.1)
|
96
128
|
sexp_processor (~> 4.16)
|
97
129
|
rubycritic (4.6.1)
|
@@ -107,7 +139,8 @@ GEM
|
|
107
139
|
virtus (~> 1.0)
|
108
140
|
russian (0.6.0)
|
109
141
|
i18n (>= 0.5.0)
|
110
|
-
|
142
|
+
securerandom (0.3.2)
|
143
|
+
set (1.1.0)
|
111
144
|
sexp_processor (4.16.0)
|
112
145
|
simplecov (0.21.2)
|
113
146
|
docile (~> 1.1)
|
@@ -127,7 +160,7 @@ GEM
|
|
127
160
|
thread_safe (0.3.6)
|
128
161
|
timeouter (0.1.3.38794)
|
129
162
|
tty-which (0.4.2)
|
130
|
-
tzinfo (2.0.
|
163
|
+
tzinfo (2.0.6)
|
131
164
|
concurrent-ruby (~> 1.0)
|
132
165
|
unicode-display_width (2.1.0)
|
133
166
|
virtus (1.0.5)
|
@@ -135,19 +168,18 @@ GEM
|
|
135
168
|
coercible (~> 1.0)
|
136
169
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
137
170
|
equalizer (~> 0.0, >= 0.0.9)
|
138
|
-
zeitwerk (2.5.3)
|
139
171
|
|
140
172
|
PLATFORMS
|
141
173
|
ruby
|
142
174
|
|
143
175
|
DEPENDENCIES
|
144
176
|
bbk-amqp!
|
145
|
-
bbk-app (>= 1.1.0.200186)
|
146
177
|
bunny-mock
|
147
178
|
byebug
|
148
179
|
rake
|
149
180
|
rspec
|
150
181
|
rspec_junit_formatter
|
182
|
+
rubocop
|
151
183
|
rubycritic
|
152
184
|
simplecov
|
153
185
|
simplecov-console
|
data/lib/bbk/amqp/consumer.rb
CHANGED
@@ -102,8 +102,8 @@ module BBK
|
|
102
102
|
|
103
103
|
# Nack incoming message
|
104
104
|
# @param incoming [BBK::AMQP::Message] nack procesing message
|
105
|
-
def nack(incoming, *args, error: nil, **
|
106
|
-
rejection_policy.call(incoming, error)
|
105
|
+
def nack(incoming, *args, error: nil, **kwargs)
|
106
|
+
rejection_policy.call(incoming, error, *args, **kwargs)
|
107
107
|
end
|
108
108
|
|
109
109
|
# stop consuming messages
|
data/lib/bbk/amqp/message.rb
CHANGED
@@ -1,28 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require 'bbk/app/dispatcher/message'
|
2
3
|
|
3
4
|
module BBK
|
4
5
|
module AMQP
|
5
6
|
# Store information about consumed AMQP message
|
6
|
-
class Message
|
7
|
+
class Message < BBK::App::Dispatcher::Message
|
7
8
|
|
8
|
-
attr_reader :
|
9
|
+
attr_reader :properties
|
9
10
|
|
10
11
|
def initialize(consumer, delivery_info, properties, body)
|
11
|
-
@consumer = consumer
|
12
12
|
@properties = properties.to_h.with_indifferent_access
|
13
|
-
|
13
|
+
headers = @properties.except(:headers).merge(@properties[:headers].presence || {}).with_indifferent_access
|
14
|
+
|
14
15
|
amqp_consumer = delivery_info[:consumer]
|
15
|
-
|
16
|
+
delivery_info = delivery_info.to_h.merge(
|
16
17
|
message_consumer: consumer,
|
17
18
|
protocols: consumer.protocols,
|
18
19
|
queue: amqp_consumer&.queue_name
|
19
20
|
)
|
20
|
-
|
21
|
-
|
22
|
-
Oj.load(body).with_indifferent_access
|
23
|
-
rescue StandardError
|
24
|
-
{}.with_indifferent_access
|
25
|
-
end
|
21
|
+
|
22
|
+
super(consumer, delivery_info, headers, body)
|
26
23
|
end
|
27
24
|
|
28
25
|
def message_id
|
@@ -37,14 +34,6 @@ module BBK
|
|
37
34
|
headers[:user_id]
|
38
35
|
end
|
39
36
|
|
40
|
-
def ack(*args, answer: nil, **kwargs)
|
41
|
-
consumer.ack(self, *args, answer: answer, **kwargs)
|
42
|
-
end
|
43
|
-
|
44
|
-
def nack(*args, error: nil, **kwargs)
|
45
|
-
consumer.nack(self, *args, error: error, **kwargs)
|
46
|
-
end
|
47
|
-
|
48
37
|
def clone
|
49
38
|
self.class.new(consumer, delivery_info, properties, body)
|
50
39
|
end
|
@@ -8,8 +8,8 @@ module BBK
|
|
8
8
|
def initialize(logger: BBK::Utils::Logger.default)
|
9
9
|
@logger = logger
|
10
10
|
end
|
11
|
-
|
12
|
-
def call(message, error)
|
11
|
+
|
12
|
+
def call(message, error, *_args, **_kwargs)
|
13
13
|
logger.debug "Reject message #{message.headers[:type]}[#{message.headers[:message_id]}] delivery tag: #{message.delivery_info[:delivery_tag].to_i}. Error: #{error.inspect}"
|
14
14
|
message.delivery_info[:channel].reject message.delivery_info[:delivery_tag], false
|
15
15
|
end
|
@@ -17,4 +17,5 @@ module BBK
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
|
-
end
|
20
|
+
end
|
21
|
+
|
@@ -12,7 +12,7 @@ module BBK
|
|
12
12
|
@logger = ActiveSupport::TaggedLogging.new(logger).tagged(self.class.name)
|
13
13
|
end
|
14
14
|
|
15
|
-
def call(message, error)
|
15
|
+
def call(message, error, *_args, **_kwargs)
|
16
16
|
if message.delivery_info[:redelivered] || message.headers.key?(REPUBLISH_COUNTER_KEY)
|
17
17
|
republish_message(message, error)
|
18
18
|
else
|
@@ -9,11 +9,13 @@ module BBK
|
|
9
9
|
@logger = logger
|
10
10
|
end
|
11
11
|
|
12
|
-
def call(message, error)
|
12
|
+
def call(message, error, *_args, **_kwargs)
|
13
13
|
logger.debug "Requeue message #{message.headers[:type]}[#{message.headers[:message_id]}] delivery tag: #{message.delivery_info[:delivery_tag].to_i}. Error: #{error.inspect}"
|
14
14
|
message.delivery_info[:channel].reject message.delivery_info[:delivery_tag], true
|
15
15
|
end
|
16
|
+
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
21
|
+
|
data/lib/bbk/amqp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbk-amqp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1.273342
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samoylenko Yuri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -25,63 +25,77 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '6.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bunny
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.19.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.19.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: oj
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '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:
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: bbk-app
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.1.1.273338
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 1.1.1.273338
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: bbk-
|
70
|
+
name: bbk-utils
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.0.1
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.0.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bunny-mock
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: '0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: rake
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
@@ -95,7 +109,7 @@ dependencies:
|
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
112
|
+
name: rspec
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - ">="
|
@@ -109,7 +123,7 @@ dependencies:
|
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
126
|
+
name: byebug
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - ">="
|
@@ -123,7 +137,7 @@ dependencies:
|
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
140
|
+
name: rspec_junit_formatter
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
143
|
- - ">="
|
@@ -137,7 +151,7 @@ dependencies:
|
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: '0'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
154
|
+
name: rubocop
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
157
|
- - ">="
|