nats_messaging 1.2.3 → 1.2.4
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/lib/nats_messaging/nats_service.rb +6 -7
- 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: 2cce5046054acc51b5c4153fd910ea70b32e95b3c0470645478c57f3aedea0a1
|
4
|
+
data.tar.gz: 4a362f7829d73a5500bc35dddea92bb6df180c9104abd599b81d55abe31d3898
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d133c523aa6a8bbf8257d206722bffd1d3a90109282cc93f6b15052853b2943e00045cc26c61080ffcf044f20ea0eef93e3ba392a24ab66be40c4f68b10a4ce
|
7
|
+
data.tar.gz: 47baf379f44055bea16382481db3f268d4cb063042a1edf6d2fba03f4f86d1a20517d7250ce82f1b0cc89e4eb8287159f4f4b08b7ba9c153f60c93f97a03ac61
|
@@ -55,11 +55,13 @@ module NatsMessaging
|
|
55
55
|
if @js
|
56
56
|
@subscriptions[subject] = @js.subscribe(subject, durable: durable_name) do |msg|
|
57
57
|
unpacked_data = process_received_message(msg, subject)
|
58
|
+
yield(subject, unpacked_data) if block_given?
|
58
59
|
unpacked_data
|
59
60
|
end
|
60
61
|
else
|
61
62
|
@subscriptions[subject] = @nats.subscribe(subject) do |msg|
|
62
63
|
unpacked_data = process_received_message(msg, subject)
|
64
|
+
yield(subject, unpacked_data) if block_given?
|
63
65
|
unpacked_data
|
64
66
|
end
|
65
67
|
end
|
@@ -103,8 +105,8 @@ module NatsMessaging
|
|
103
105
|
unpacked_data = nil
|
104
106
|
begin
|
105
107
|
# Create a new subscription
|
106
|
-
puts "NATS:
|
107
|
-
|
108
|
+
puts "NATS: Listening on #{subject} with reply message: #{reply_message}"
|
109
|
+
@subscriptions[subject] = @nats.subscribe(subject) do |msg|
|
108
110
|
begin
|
109
111
|
unpacked_data = MessagePack.unpack(msg.data) # Deserializar mensaje recibido
|
110
112
|
puts "NATS: Received request on #{subject}: #{unpacked_data}"
|
@@ -116,6 +118,8 @@ module NatsMessaging
|
|
116
118
|
else
|
117
119
|
puts "NATS: No reply subject for #{subject}, cannot respond"
|
118
120
|
end
|
121
|
+
yield(subject, unpacked_data) if block_given?
|
122
|
+
unpacked_data
|
119
123
|
rescue => e
|
120
124
|
puts "NATS: Error while processing message: #{e.message}"
|
121
125
|
end
|
@@ -123,11 +127,6 @@ module NatsMessaging
|
|
123
127
|
rescue => e
|
124
128
|
puts "NATS: Error while replying: #{e.message}"
|
125
129
|
end
|
126
|
-
|
127
|
-
# Store the new subscription in the hash
|
128
|
-
@subscriptions[subject] = subscription
|
129
|
-
puts "NATS: Listening on #{subject} with reply message: #{reply_message}"
|
130
|
-
unpacked_data
|
131
130
|
end
|
132
131
|
end
|
133
132
|
end
|