bbk-amqp 1.1.0.199382 → 1.1.0.199673
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bbk/amqp/message.rb +4 -0
- data/lib/bbk/amqp/publisher.rb +13 -1
- data/lib/bbk/amqp/route_info.rb +3 -2
- 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: f0b21d66df4389ae96920aa75d3aee69e1c97cbd8919aceaeeb7fea411d4c643
|
4
|
+
data.tar.gz: d9791ff11d25ce1d46a62ad09b59327d06dbc1ac12760f912babdf8da45ae79e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88298615abd56544b85c53066290a6dc9f39f5e5f338b90027645f9c2d612544c269ab7b35a588d9956e608d7b165e5ca00f26b5f389fb6151ae3323d1d84c80
|
7
|
+
data.tar.gz: 8f2f0d852f3bdf6aa63a65d5f1516ab32a2487f46e52e7ad6ba0072619eadc5b9bce2fe9e22bd02ed9acbee64235ce1f778c57b97420e35e8c1f2582d7bc795b
|
data/Gemfile.lock
CHANGED
data/lib/bbk/amqp/message.rb
CHANGED
data/lib/bbk/amqp/publisher.rb
CHANGED
@@ -11,6 +11,18 @@ module BBK
|
|
11
11
|
HEADER_PROP_FIELDS = %i[message_id reply_to correlation_id].freeze
|
12
12
|
PROTOCOLS = %w[mq amqp amqps].freeze
|
13
13
|
|
14
|
+
class PublishedMessage
|
15
|
+
|
16
|
+
attr_reader :headers, :payload
|
17
|
+
|
18
|
+
def initialize(headers, payload)
|
19
|
+
@headers = headers
|
20
|
+
@payload = payload
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
|
14
26
|
attr_reader :connection, :domains, :logger, :channel, :ack_map, :sended_messages, :channel
|
15
27
|
|
16
28
|
def initialize(connection, domains, logger: BBK::AMQP.logger)
|
@@ -57,7 +69,7 @@ module BBK
|
|
57
69
|
|
58
70
|
route_info = domain.call(route)
|
59
71
|
message = result.message
|
60
|
-
publish_message(route_info.routing_key, message, exchange: route_info.exchange)
|
72
|
+
publish_message(route_info.routing_key, PublishedMessage.new({**message.headers, **route_info.headers}, message.payload), exchange: route_info.exchange)
|
61
73
|
end
|
62
74
|
|
63
75
|
# Publish message
|
data/lib/bbk/amqp/route_info.rb
CHANGED
@@ -2,11 +2,12 @@ module BBK
|
|
2
2
|
module AMQP
|
3
3
|
class RouteInfo
|
4
4
|
|
5
|
-
attr_reader :exchange, :routing_key
|
5
|
+
attr_reader :exchange, :routing_key, :headers
|
6
6
|
|
7
|
-
def initialize(exchange, routing_key)
|
7
|
+
def initialize(exchange, routing_key, **headers_params)
|
8
8
|
@exchange = exchange
|
9
9
|
@routing_key = routing_key
|
10
|
+
@headers = headers_params
|
10
11
|
end
|
11
12
|
|
12
13
|
end
|
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.0.
|
4
|
+
version: 1.1.0.199673
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samoylenko Yuri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|