bbk-app 1.1.1.289658 → 1.1.1.289665
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/Gemfile.lock +1 -1
- data/lib/bbk/app/dispatcher.rb +10 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0a0e8837fd2b2114213ab0ddab182faa7e861cb8ab59b014ef38d15abc3a7a18
|
|
4
|
+
data.tar.gz: d922557b53b0c10914ebf52b54395d25121252e053346773fc507e2e054faf40
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66814da21956e2fc4e2084df654235e2742ea194758778da6262911ddce8a62055da207c930f3b73f23bdd4e886419345bbbef7d82d403edc164c993dcba93a6
|
|
7
|
+
data.tar.gz: 0b03d263a0a70596718148933354a35c5a621a5cabd45bfac00d141a5e4be33804fe5dfe448ef92bba237ae8fe27f06c4d2493dbe2f04abcdf2f18886ff60b6f
|
data/Gemfile.lock
CHANGED
data/lib/bbk/app/dispatcher.rb
CHANGED
|
@@ -56,6 +56,7 @@ module BBK
|
|
|
56
56
|
|
|
57
57
|
def register_publisher(publisher)
|
|
58
58
|
raise "Publisher support #{DEFAULT_PROTOCOL}" if publisher.protocols.include?(DEFAULT_PROTOCOL)
|
|
59
|
+
|
|
59
60
|
publishers << publisher
|
|
60
61
|
end
|
|
61
62
|
|
|
@@ -129,6 +130,10 @@ module BBK
|
|
|
129
130
|
# process one message and sending existed results messages
|
|
130
131
|
def process(message)
|
|
131
132
|
results = execute_message(message)
|
|
133
|
+
if message.respond_to?(:nacked?) && message.nacked?
|
|
134
|
+
logger.debug "Ignore sending results: message(#{message.headers[:message_id]}) nacked in processor"
|
|
135
|
+
return
|
|
136
|
+
end
|
|
132
137
|
logger.debug "There are #{results.count} results to send from #{message.headers[:message_id]}..."
|
|
133
138
|
send_results(message, results).value
|
|
134
139
|
rescue StandardError => e
|
|
@@ -145,7 +150,8 @@ module BBK
|
|
|
145
150
|
results = []
|
|
146
151
|
begin
|
|
147
152
|
is_unknown = @observer.instance_variable_get('@default') == processor
|
|
148
|
-
ActiveSupport::Notifications.instrument 'dispatcher.request.process', msg: message,
|
|
153
|
+
ActiveSupport::Notifications.instrument 'dispatcher.request.process', msg: message,
|
|
154
|
+
match: matched, unknown: is_unknown do
|
|
149
155
|
processor.call(message, results: results)
|
|
150
156
|
end
|
|
151
157
|
rescue StandardError => e
|
|
@@ -158,7 +164,8 @@ module BBK
|
|
|
158
164
|
end
|
|
159
165
|
[results].flatten
|
|
160
166
|
rescue StandardError => e
|
|
161
|
-
ActiveSupport::Notifications.instrument 'dispatcher.request.exception', msg: message,
|
|
167
|
+
ActiveSupport::Notifications.instrument 'dispatcher.request.exception', msg: message,
|
|
168
|
+
match: matched, processor: processor, exception: e
|
|
162
169
|
raise
|
|
163
170
|
end
|
|
164
171
|
|
|
@@ -184,7 +191,7 @@ module BBK
|
|
|
184
191
|
answers, sended_messages = results.partition { _1.route.domain == ANSWER_DOMAIN }
|
|
185
192
|
# allowed only one answer message
|
|
186
193
|
raise InvalidAnswersMessagesCountError.new("Get #{answers.size} on processing message with id=#{message_id}") if answers.size > 1
|
|
187
|
-
|
|
194
|
+
|
|
188
195
|
answer = answers.first
|
|
189
196
|
Concurrent::Promises.zip_futures(*sended_messages.map do |result|
|
|
190
197
|
publish_result(result)
|