nats 0.5.0.beta.16 → 0.5.0
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/HISTORY.md +5 -0
- data/README.md +32 -16
- data/lib/nats/client.rb +25 -4
- data/lib/nats/server.rb +1 -0
- data/lib/nats/server/const.rb +1 -1
- data/nats.gemspec +5 -5
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 854c4efd26b49d2deb4bf7a193d4772e94e2a4aa
|
4
|
+
data.tar.gz: ec49fc499a9e7a5ea0358c302715846320d0ecb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e23d8a54b39f792851d216223923ee01c4e32870f4ebebd757c8d9eb7f61c89b57d0ec5ed811899550df5d97f7076aef5dd41b2c4d65a3239a61e18fbc80d8c7
|
7
|
+
data.tar.gz: 436d5d9485298a9257bd5d0ad248f483d0e1ba09a1464559e18c7526f28f5f100ed4951043879a562112fc794a88e4302b1a4089269f3e5a1f1bfb074a2f39f3
|
data/HISTORY.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# HISTORY
|
2
2
|
|
3
|
+
## v0.5.0.beta.16 (December 7, 2014)
|
4
|
+
- Resolved major issue on cluster connects to non-first server, issue #78
|
5
|
+
- Official Support for Ruby 2.1
|
6
|
+
- See full list @ https://github.com/derekcollison/nats/compare/v0.5.0.beta.12...v0.5.0.beta.16
|
7
|
+
|
3
8
|
## v0.5.0.beta.12 (October 1, 2013)
|
4
9
|
- Fixed issue #58, reconnects not stopped on auth failures
|
5
10
|
- Fixed leaking ping timers on auth failures
|
data/README.md
CHANGED
@@ -1,25 +1,19 @@
|
|
1
|
-
# NATS
|
1
|
+
# NATS - Ruby Client
|
2
2
|
|
3
|
-
A
|
3
|
+
A [Ruby](http://ruby-lang.org) client for the [NATS messaging system](https://nats.io).
|
4
4
|
|
5
|
-
[](http://opensource.org/licenses/MIT)
|
6
|
+
[](http://travis-ci.org/nats-io/ruby-nats) [](https://rubygems.org/gems/nats/versions/0.5.0) [](http://www.rubydoc.info/github/nats-io/ruby-nats)
|
6
7
|
|
7
|
-
## Supported Platforms
|
8
|
-
|
9
|
-
This gem currently works on the following Ruby platforms:
|
10
8
|
|
11
|
-
|
12
|
-
- Rubinius
|
13
|
-
- JRuby
|
9
|
+
## Supported Platforms
|
14
10
|
|
15
|
-
|
11
|
+
This gem and the client are known to work on the following Ruby platforms:
|
16
12
|
|
17
|
-
|
13
|
+
- MRI 1.9, 2.0, 2.1
|
14
|
+
- JRuby 1.6.8 (experimental)
|
18
15
|
|
19
|
-
|
20
|
-
- [Go](https://github.com/apcera/nats)
|
21
|
-
- [Java](https://github.com/tyagihas/java_nats)
|
22
|
-
- [Java - Spring](https://github.com/mheath/jnats)
|
16
|
+
Note: This installation installs a version of the NATS server written in Ruby that has been deprecated. Please utilize a supported server such as [gnatsd](https://github.com/apcera/gnatsd). nats-server will be removed in a future release.
|
23
17
|
|
24
18
|
## Getting Started
|
25
19
|
|
@@ -84,6 +78,28 @@ NATS.subscribe('foo.>') { |msg, reply, sub| puts "Msg received on [#{sub}] : '#{
|
|
84
78
|
NATS.subscribe(subject, :queue => 'job.workers') { |msg| puts "Received '#{msg}'" }
|
85
79
|
```
|
86
80
|
|
81
|
+
## Clustered Usage
|
82
|
+
```ruby
|
83
|
+
NATS.start(:servers => ['nats://127.0.0.1:4222', 'nats://127.0.0.1:4223'] do |c|
|
84
|
+
puts "NATS is connected to #{c.connected_server}"
|
85
|
+
c.on_reconnect do
|
86
|
+
puts "Reconnected to server at #{c.connected_server}
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
opts = {
|
91
|
+
:dont_randomize_servers => true,
|
92
|
+
:reconnect_time_wait => 0.5,
|
93
|
+
:max_reconnect_attempts = 10,
|
94
|
+
:servers => ['nats://127.0.0.1:4222', 'nats://127.0.0.1:4223', 'nats://127.0.0.1:4224]
|
95
|
+
}
|
96
|
+
|
97
|
+
NATS.connect(opts) do |c|
|
98
|
+
puts "NATS is connected!"
|
99
|
+
end
|
100
|
+
|
101
|
+
```
|
102
|
+
|
87
103
|
## Advanced Usage
|
88
104
|
```ruby
|
89
105
|
# Publish with closure, callback fires when server has processed the message
|
@@ -115,7 +131,7 @@ See examples and benchmarks for more information..
|
|
115
131
|
|
116
132
|
(The MIT License)
|
117
133
|
|
118
|
-
Copyright (c) 2010-
|
134
|
+
Copyright (c) 2010-2015 Derek Collison
|
119
135
|
|
120
136
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
121
137
|
of this software and associated documentation files (the "Software"), to
|
data/lib/nats/client.rb
CHANGED
@@ -9,7 +9,7 @@ require "#{ep}/ext/json"
|
|
9
9
|
|
10
10
|
module NATS
|
11
11
|
|
12
|
-
VERSION = "0.5.0
|
12
|
+
VERSION = "0.5.0".freeze
|
13
13
|
|
14
14
|
DEFAULT_PORT = 4222
|
15
15
|
DEFAULT_URI = "nats://localhost:#{DEFAULT_PORT}".freeze
|
@@ -164,6 +164,12 @@ module NATS
|
|
164
164
|
@err_cb = nil
|
165
165
|
end
|
166
166
|
|
167
|
+
# @return [URI] Connected server
|
168
|
+
def connected_server
|
169
|
+
return nil unless client
|
170
|
+
client.connected_server
|
171
|
+
end
|
172
|
+
|
167
173
|
# @return [Boolean] Connected state
|
168
174
|
def connected?
|
169
175
|
return false unless client
|
@@ -461,7 +467,12 @@ module NATS
|
|
461
467
|
end
|
462
468
|
|
463
469
|
def connect_command #:nodoc:
|
464
|
-
cs = {
|
470
|
+
cs = {
|
471
|
+
:verbose => @options[:verbose],
|
472
|
+
:pedantic => @options[:pedantic],
|
473
|
+
:lang => "ruby",
|
474
|
+
:version => VERSION
|
475
|
+
}
|
465
476
|
if auth_connection?
|
466
477
|
cs[:user] = @uri.user
|
467
478
|
cs[:pass] = @uri.password
|
@@ -630,7 +641,12 @@ module NATS
|
|
630
641
|
@conn_cb_called = true
|
631
642
|
end
|
632
643
|
end
|
633
|
-
|
644
|
+
|
645
|
+
if reconnecting?
|
646
|
+
@reconnecting = false
|
647
|
+
@reconnect_cb.call unless @reconnect_cb.nil?
|
648
|
+
end
|
649
|
+
|
634
650
|
@parse_state = AWAITING_CONTROL_LINE
|
635
651
|
|
636
652
|
# Initialize ping timer and processing
|
@@ -728,8 +744,10 @@ module NATS
|
|
728
744
|
begin
|
729
745
|
EM.reconnect(@uri.host, @uri.port, self)
|
730
746
|
rescue
|
747
|
+
current[:error_received] = true
|
748
|
+
@uri = nil
|
749
|
+
@connected = false
|
731
750
|
end
|
732
|
-
@reconnect_cb.call unless @reconnect_cb.nil?
|
733
751
|
end
|
734
752
|
|
735
753
|
def send_command(command, priority = false) #:nodoc:
|
@@ -755,6 +773,7 @@ module NATS
|
|
755
773
|
bind_primary
|
756
774
|
end
|
757
775
|
|
776
|
+
# @return [URI] Connected server
|
758
777
|
def connected_server
|
759
778
|
connected? ? @uri : nil
|
760
779
|
end
|
@@ -771,6 +790,7 @@ module NATS
|
|
771
790
|
def schedule_primary_and_connect #:nodoc:
|
772
791
|
# Dump the one we were trying if it wasn't connected
|
773
792
|
current = server_pool.shift
|
793
|
+
# FIXME(dlc) - Should we remove from the list on error?
|
774
794
|
server_pool << current if (current && can_reuse_server?(current) && !current[:error_received])
|
775
795
|
# If we are out of options, go ahead and disconnect.
|
776
796
|
process_disconnect and return if server_pool.empty?
|
@@ -782,6 +802,7 @@ module NATS
|
|
782
802
|
schedule_reconnect
|
783
803
|
else
|
784
804
|
attempt_reconnect
|
805
|
+
schedule_primary_and_connect if had_error?
|
785
806
|
end
|
786
807
|
end
|
787
808
|
|
data/lib/nats/server.rb
CHANGED
@@ -26,6 +26,7 @@ NATSD::Server.setup(ARGV.dup)
|
|
26
26
|
# Event Loop
|
27
27
|
EM.run do
|
28
28
|
|
29
|
+
log "WARNING: nats-server is deprecated and no longer supported. It will be removed in a future release. See https://github.com/apcera/gnatsd."
|
29
30
|
log "Starting #{NATSD::APP_NAME} version #{NATSD::VERSION} on port #{NATSD::Server.port}"
|
30
31
|
log "TLS/SSL Support Enabled" if NATSD::Server.options[:ssl]
|
31
32
|
begin
|
data/lib/nats/server/const.rb
CHANGED
data/nats.gemspec
CHANGED
@@ -8,18 +8,18 @@ require 'nats/server/const'
|
|
8
8
|
spec = Gem::Specification.new do |s|
|
9
9
|
s.name = 'nats'
|
10
10
|
s.version = NATSD::VERSION
|
11
|
-
s.summary = '
|
12
|
-
s.homepage = '
|
13
|
-
s.description = '
|
11
|
+
s.summary = 'NATS is an open-source, high-performance, lightweight cloud messaging system.'
|
12
|
+
s.homepage = 'https://nats.io'
|
13
|
+
s.description = 'NATS is an open-source, high-performance, lightweight cloud messaging system.'
|
14
14
|
s.licenses = ['MIT']
|
15
15
|
s.has_rdoc = true
|
16
16
|
|
17
17
|
s.authors = ['Derek Collison']
|
18
18
|
s.email = ['derek.collison@gmail.com']
|
19
19
|
|
20
|
-
s.add_dependency('eventmachine', '~> 1.0', '>= 1.0.
|
20
|
+
s.add_dependency('eventmachine', '~> 1.0', '>= 1.0.7')
|
21
21
|
s.add_dependency('json_pure', '~> 1.8', '>= 1.8.1')
|
22
|
-
s.add_dependency('daemons', '~> 1.1', '>= 1.
|
22
|
+
s.add_dependency('daemons', '~> 1.1', '>= 1.2.2')
|
23
23
|
s.add_dependency('thin', '~> 1.6', '>= 1.6.3')
|
24
24
|
|
25
25
|
s.require_paths = ['lib']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derek Collison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '1.0'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.0.
|
22
|
+
version: 1.0.7
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '1.0'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.0.
|
32
|
+
version: 1.0.7
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: json_pure
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
version: '1.1'
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 1.
|
62
|
+
version: 1.2.2
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
version: '1.1'
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 1.
|
72
|
+
version: 1.2.2
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: thin
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,8 @@ dependencies:
|
|
90
90
|
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: 1.6.3
|
93
|
-
description:
|
93
|
+
description: NATS is an open-source, high-performance, lightweight cloud messaging
|
94
|
+
system.
|
94
95
|
email:
|
95
96
|
- derek.collison@gmail.com
|
96
97
|
executables:
|
@@ -129,7 +130,7 @@ files:
|
|
129
130
|
- lib/nats/server/util.rb
|
130
131
|
- lib/nats/server/varz.rb
|
131
132
|
- nats.gemspec
|
132
|
-
homepage:
|
133
|
+
homepage: https://nats.io
|
133
134
|
licenses:
|
134
135
|
- MIT
|
135
136
|
metadata: {}
|
@@ -144,13 +145,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
145
|
version: '0'
|
145
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
147
|
requirements:
|
147
|
-
- - "
|
148
|
+
- - ">="
|
148
149
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
150
|
+
version: '0'
|
150
151
|
requirements: []
|
151
152
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.4.
|
153
|
+
rubygems_version: 2.4.8
|
153
154
|
signing_key:
|
154
155
|
specification_version: 4
|
155
|
-
summary:
|
156
|
+
summary: NATS is an open-source, high-performance, lightweight cloud messaging system.
|
156
157
|
test_files: []
|