nats-pure 0.7.0 → 0.7.2
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/io/client.rb +26 -0
- data/lib/nats/io/version.rb +2 -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: 1283c1d3b53b281eec2c1fb01643b3efd51c7b2468a54006f4afc9b0aa6cfffd
|
4
|
+
data.tar.gz: d6777d4b80d57b44da776e75be073f67fd76c3a7d23cf66fa7a2dc96f74afe64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb44bb3872296a3cce5416777b2e85c5c2046fb64a545157fd3661754a31311b9bf2d032494d5eb1e34a08c1e0d2f3982538a098f0066f30c2a5c16823ee8ec8
|
7
|
+
data.tar.gz: f5a2e1f1a836392030c1abc0d8ee65a3b19e2bb371d7c3cae0c8107ae5444a13609275f85c6ec12c06070218e1220ec36bb57eba4d8a7c86b4ac314eba6ddc4e
|
data/lib/nats/io/client.rb
CHANGED
@@ -28,6 +28,15 @@ rescue LoadError
|
|
28
28
|
end
|
29
29
|
|
30
30
|
module NATS
|
31
|
+
class << self
|
32
|
+
def connect(uri=nil, opts={})
|
33
|
+
nc = NATS::IO::Client.new
|
34
|
+
nc.connect(uri, opts)
|
35
|
+
|
36
|
+
nc
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
31
40
|
module IO
|
32
41
|
|
33
42
|
DEFAULT_PORT = 4222
|
@@ -185,6 +194,9 @@ module NATS
|
|
185
194
|
@hostname = nil
|
186
195
|
@single_url_connect_used = false
|
187
196
|
|
197
|
+
# Track whether connect has been already been called.
|
198
|
+
@connect_called = false
|
199
|
+
|
188
200
|
# New style request/response implementation.
|
189
201
|
@resp_sub = nil
|
190
202
|
@resp_map = nil
|
@@ -201,6 +213,15 @@ module NATS
|
|
201
213
|
|
202
214
|
# Establishes connection to NATS.
|
203
215
|
def connect(uri=nil, opts={})
|
216
|
+
synchronize do
|
217
|
+
# In case it has been connected already, then do not need to call this again.
|
218
|
+
return if @connect_called
|
219
|
+
@connect_called = true
|
220
|
+
end
|
221
|
+
|
222
|
+
# Convert URI to string if needed.
|
223
|
+
uri = uri.to_s if uri.is_a?(URI)
|
224
|
+
|
204
225
|
case uri
|
205
226
|
when String
|
206
227
|
# Initialize TLS defaults in case any url is using it.
|
@@ -615,6 +636,11 @@ module NATS
|
|
615
636
|
end
|
616
637
|
response = sub.response
|
617
638
|
|
639
|
+
if response and response.header
|
640
|
+
status = response.header[STATUS_HDR]
|
641
|
+
raise NoRespondersError if status == "503"
|
642
|
+
end
|
643
|
+
|
618
644
|
response
|
619
645
|
end
|
620
646
|
|
data/lib/nats/io/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2016-
|
1
|
+
# Copyright 2016-2021 The NATS Authors
|
2
2
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
3
|
# you may not use this file except in compliance with the License.
|
4
4
|
# You may obtain a copy of the License at
|
@@ -15,7 +15,7 @@
|
|
15
15
|
module NATS
|
16
16
|
module IO
|
17
17
|
# NOTE: These are all announced to the server on CONNECT
|
18
|
-
VERSION = "0.7.
|
18
|
+
VERSION = "0.7.2"
|
19
19
|
LANG = "#{RUBY_ENGINE}#{RUBY_VERSION}".freeze
|
20
20
|
PROTOCOL = 1
|
21
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nats-pure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Waldemar Quevedo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: NATS is an open-source, high-performance, lightweight cloud messaging
|
14
14
|
system.
|