bbk-amqp 1.1.1.273631 → 1.1.2.342510
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 +17 -16
- data/lib/bbk/amqp/publisher.rb +18 -2
- data/lib/bbk/amqp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bd18edb0b3b8f08ef5f14ad42210636abc623e61a00a18ff7197a671b0c2f2b8
|
|
4
|
+
data.tar.gz: 1d05f661df144b28ec0eaedd5144331d767b2b4d2b3e8345567bd29ff6ca0bcc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d19ee7bdea5510d9469237327015a14a21ca2344ccb39395d9050869d92a5c1287499290680f1e4ef795e8e9aa2b677ea089c4b8106455ce45e3fac4a8035c07
|
|
7
|
+
data.tar.gz: 6a3ed0fa985e35c57c059876e079c1d05062d87544b2179584bbdf7aeb848f95009920fbe16890697f0d676257f2c1c906fe256225b9e2b7da737deeebf3ccc3
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
bbk-amqp (1.1.
|
|
4
|
+
bbk-amqp (1.1.2.342510)
|
|
5
5
|
activesupport (>= 6.0)
|
|
6
6
|
bbk-app (>= 1.1.1.273338)
|
|
7
7
|
bbk-utils (> 1.0.1)
|
|
@@ -11,7 +11,7 @@ PATH
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
activesupport (7.1.
|
|
14
|
+
activesupport (7.1.6)
|
|
15
15
|
base64
|
|
16
16
|
benchmark (>= 0.3)
|
|
17
17
|
bigdecimal
|
|
@@ -33,17 +33,18 @@ GEM
|
|
|
33
33
|
descendants_tracker (~> 0.0.4)
|
|
34
34
|
ice_nine (~> 0.11.0)
|
|
35
35
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
36
|
-
base64 (0.
|
|
37
|
-
bbk-app (1.1.
|
|
36
|
+
base64 (0.3.0)
|
|
37
|
+
bbk-app (1.1.3.335065)
|
|
38
38
|
activesupport (>= 6.0)
|
|
39
39
|
bbk-utils (> 1.0.1)
|
|
40
40
|
oj
|
|
41
41
|
timeouter
|
|
42
|
-
bbk-utils (1.1.
|
|
42
|
+
bbk-utils (1.1.2.304819)
|
|
43
43
|
activesupport (>= 7.0)
|
|
44
44
|
russian
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
securerandom (~> 0.3.2)
|
|
46
|
+
benchmark (0.5.0)
|
|
47
|
+
bigdecimal (3.3.1)
|
|
47
48
|
bunny (2.23.0)
|
|
48
49
|
amq-protocol (~> 2.3, >= 2.3.1)
|
|
49
50
|
sorted_set (~> 1, >= 1.0.2)
|
|
@@ -52,13 +53,13 @@ GEM
|
|
|
52
53
|
byebug (11.1.3)
|
|
53
54
|
coercible (1.0.0)
|
|
54
55
|
descendants_tracker (~> 0.0.1)
|
|
55
|
-
concurrent-ruby (1.3.
|
|
56
|
-
connection_pool (2.
|
|
56
|
+
concurrent-ruby (1.3.5)
|
|
57
|
+
connection_pool (2.5.5)
|
|
57
58
|
descendants_tracker (0.0.4)
|
|
58
59
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
59
60
|
diff-lcs (1.5.1)
|
|
60
61
|
docile (1.4.0)
|
|
61
|
-
drb (2.2.
|
|
62
|
+
drb (2.2.3)
|
|
62
63
|
equalizer (0.0.11)
|
|
63
64
|
erubis (2.7.0)
|
|
64
65
|
flay (2.12.1)
|
|
@@ -70,19 +71,19 @@ GEM
|
|
|
70
71
|
path_expander (~> 1.0)
|
|
71
72
|
ruby_parser (~> 3.1, > 3.1.0)
|
|
72
73
|
sexp_processor (~> 4.8)
|
|
73
|
-
i18n (1.14.
|
|
74
|
+
i18n (1.14.7)
|
|
74
75
|
concurrent-ruby (~> 1.0)
|
|
75
76
|
ice_nine (0.11.2)
|
|
76
77
|
kwalify (0.7.2)
|
|
77
78
|
launchy (2.5.0)
|
|
78
79
|
addressable (~> 2.7)
|
|
79
|
-
logger (1.
|
|
80
|
-
minitest (5.
|
|
81
|
-
mutex_m (0.
|
|
82
|
-
oj (3.16.
|
|
80
|
+
logger (1.7.0)
|
|
81
|
+
minitest (5.26.1)
|
|
82
|
+
mutex_m (0.3.0)
|
|
83
|
+
oj (3.16.12)
|
|
83
84
|
bigdecimal (>= 3.0)
|
|
84
85
|
ostruct (>= 0.2)
|
|
85
|
-
ostruct (0.6.
|
|
86
|
+
ostruct (0.6.3)
|
|
86
87
|
parallel (1.26.3)
|
|
87
88
|
parser (3.0.3.2)
|
|
88
89
|
ast (~> 2.4.1)
|
data/lib/bbk/amqp/publisher.rb
CHANGED
|
@@ -8,7 +8,7 @@ module BBK
|
|
|
8
8
|
# Publisher send amqp messages
|
|
9
9
|
class Publisher
|
|
10
10
|
|
|
11
|
-
HEADER_PROP_FIELDS = %i[message_id reply_to correlation_id].freeze
|
|
11
|
+
HEADER_PROP_FIELDS = %i[message_id reply_to correlation_id, timestamp].freeze
|
|
12
12
|
PROTOCOLS = %w[mq amqp amqps].freeze
|
|
13
13
|
|
|
14
14
|
class PublishedMessage
|
|
@@ -22,6 +22,21 @@ module BBK
|
|
|
22
22
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
# Исключение используемое для reject промиса - так удобнее в рамках работы с ними (проще вернуть исключение, иначе если вернуть hash то будет считать что это множество исключений)
|
|
26
|
+
class ReturnError < StandardError
|
|
27
|
+
|
|
28
|
+
attr_reader :exchange, :basic_return, :properties, :body
|
|
29
|
+
|
|
30
|
+
def initialize(exchange:, basic_return:, properties: , body: , **kwargs)
|
|
31
|
+
@exchange = exchange
|
|
32
|
+
@basic_return = basic_return
|
|
33
|
+
@properties = properties
|
|
34
|
+
@body = body
|
|
35
|
+
super("Error on public message(headers=#{properties[:headers]}) to exchange(#{exchange.name}): #{basic_return}")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
25
40
|
|
|
26
41
|
attr_reader :connection, :domains, :logger, :channel, :ack_map, :sended_messages, :channel
|
|
27
42
|
|
|
@@ -79,6 +94,7 @@ module BBK
|
|
|
79
94
|
# @param exchange [String] exchange for sending message
|
|
80
95
|
# @param options [Hash] message properties
|
|
81
96
|
def publish_message(routing_key, message, exchange:, options: {})
|
|
97
|
+
message.headers[:timestamp] ||= Time.now.to_i
|
|
82
98
|
logger.debug "Try publish message #{message.headers.inspect}"
|
|
83
99
|
properties = {
|
|
84
100
|
persistent: true,
|
|
@@ -138,7 +154,7 @@ module BBK
|
|
|
138
154
|
logger.info "Message with message_id #{message_id} returned #{basic_return.inspect}"
|
|
139
155
|
ack_id, = ack_map.each_pair.find {|_, msg_id| msg_id == message_id }
|
|
140
156
|
|
|
141
|
-
sended_messages.delete(ack_id)&.reject(args) if ack_map.delete(ack_id)
|
|
157
|
+
sended_messages.delete(ack_id)&.reject(ReturnError.new(**args)) if ack_map.delete(ack_id)
|
|
142
158
|
rescue StandardError => e
|
|
143
159
|
# TODO: возможно стоит попробовать почистить ack_map и sended_messages
|
|
144
160
|
logger.error "[CRITICAL]: #{e.inspect}.\n#{e.backtrace.first(10).join("\n")}"
|
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.2.342510
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samoylenko Yuri
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-11-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|