nats 0.4.24 → 0.4.26
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +5 -0
- data/lib/nats/client.rb +6 -4
- data/lib/nats/server.rb +1 -0
- data/lib/nats/server/const.rb +1 -1
- data/lib/nats/server/options.rb +14 -0
- data/lib/nats/server/server.rb +2 -1
- data/lib/nats/server/util.rb +12 -2
- data/nats.gemspec +1 -1
- metadata +32 -12
data/HISTORY.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# HISTORY
|
2
2
|
|
3
|
+
## v0.4.26 (July 30, 2012)
|
4
|
+
- Syslog support
|
5
|
+
- Fixed reconnect bug to authorized servers
|
6
|
+
- See full list @ https://github.com/derekcollison/nats/compare/v0.4.24...v0.4.26
|
7
|
+
|
3
8
|
## v0.4.24 (May 24, 2012)
|
4
9
|
|
5
10
|
- Persist queue groups across reconnects
|
data/lib/nats/client.rb
CHANGED
@@ -8,7 +8,7 @@ require "#{ep}/ext/json"
|
|
8
8
|
|
9
9
|
module NATS
|
10
10
|
|
11
|
-
VERSION = '0.4.
|
11
|
+
VERSION = '0.4.26'.freeze
|
12
12
|
|
13
13
|
DEFAULT_PORT = 4222
|
14
14
|
DEFAULT_URI = "nats://localhost:#{DEFAULT_PORT}".freeze
|
@@ -439,7 +439,7 @@ module NATS
|
|
439
439
|
cs[:pass] = @uri.password
|
440
440
|
end
|
441
441
|
cs[:ssl_required] = @ssl if @ssl
|
442
|
-
send_command("CONNECT #{cs.to_json}#{CR_LF}")
|
442
|
+
send_command("CONNECT #{cs.to_json}#{CR_LF}", true)
|
443
443
|
end
|
444
444
|
|
445
445
|
def queue_server_rt(&cb) #:nodoc:
|
@@ -613,9 +613,11 @@ module NATS
|
|
613
613
|
@reconnect_cb.call unless @reconnect_cb.nil?
|
614
614
|
end
|
615
615
|
|
616
|
-
def send_command(command) #:nodoc:
|
616
|
+
def send_command(command, priority = false) #:nodoc:
|
617
617
|
EM.next_tick { flush_pending } if (connected? && @pending.nil?)
|
618
|
-
|
618
|
+
@pending ||= []
|
619
|
+
@pending << command unless priority
|
620
|
+
@pending.unshift(command) if priority
|
619
621
|
@pending_size += command.bytesize
|
620
622
|
flush_pending if (connected? && @pending_size > MAX_PENDING_SIZE)
|
621
623
|
if (@options[:fast_producer_error] && pending_data_size > FAST_PRODUCER_THRESHOLD)
|
data/lib/nats/server.rb
CHANGED
data/lib/nats/server/const.rb
CHANGED
data/lib/nats/server/options.rb
CHANGED
@@ -27,6 +27,7 @@ module NATSD
|
|
27
27
|
|
28
28
|
opts.on("-l", "--log FILE", "File to redirect log output") { |file| @options[:log_file] = file }
|
29
29
|
opts.on("-T", "--logtime", "Timestamp log entries (default: false)") { @options[:log_time] = true }
|
30
|
+
opts.on("-S", "--syslog IDENT", "Enable Syslog output") { |ident| @options[:syslog] = ident }
|
30
31
|
opts.on("-D", "--debug", "Enable debugging output") { @options[:debug] = true }
|
31
32
|
opts.on("-V", "--trace", "Trace the raw protocol") { @options[:trace] = true }
|
32
33
|
|
@@ -77,6 +78,7 @@ module NATSD
|
|
77
78
|
@options[:pid_file] = config['pid_file'] if @options[:pid_file].nil?
|
78
79
|
@options[:log_file] = config['log_file'] if @options[:log_file].nil?
|
79
80
|
@options[:log_time] = config['logtime'] if @options[:log_time].nil?
|
81
|
+
@options[:syslog] = config['syslog'] if @options[:syslog].nil?
|
80
82
|
@options[:debug] = config['debug'] if @options[:debug].nil?
|
81
83
|
@options[:trace] = config['trace'] if @options[:trace].nil?
|
82
84
|
|
@@ -116,6 +118,15 @@ module NATSD
|
|
116
118
|
$stderr.reopen($stdout)
|
117
119
|
end
|
118
120
|
|
121
|
+
def open_syslog
|
122
|
+
return unless @options[:syslog]
|
123
|
+
Syslog.open("#{@options[:syslog]}", Syslog::LOG_PID, Syslog::LOG_USER ) unless Syslog.opened?
|
124
|
+
end
|
125
|
+
|
126
|
+
def close_syslog
|
127
|
+
Syslog.close if @options[:syslog]
|
128
|
+
end
|
129
|
+
|
119
130
|
def symbolize_users(users)
|
120
131
|
return nil unless users
|
121
132
|
auth_users = []
|
@@ -145,6 +156,9 @@ module NATSD
|
|
145
156
|
debug "DEBUG is on"
|
146
157
|
trace "TRACE is on"
|
147
158
|
|
159
|
+
# Syslog
|
160
|
+
@syslog = @options[:syslog]
|
161
|
+
|
148
162
|
# Authorization
|
149
163
|
|
150
164
|
# Multi-user setup for auth
|
data/lib/nats/server/server.rb
CHANGED
@@ -6,7 +6,7 @@ module NATSD #:nodoc: all
|
|
6
6
|
class Server
|
7
7
|
|
8
8
|
class << self
|
9
|
-
attr_reader :id, :info, :log_time, :auth_required, :ssl_required, :debug_flag, :trace_flag, :options
|
9
|
+
attr_reader :id, :info, :log_time, :auth_required, :ssl_required, :debug_flag, :trace_flag, :syslog, :options
|
10
10
|
attr_reader :max_payload, :max_pending, :max_control_line, :auth_timeout, :ssl_timeout, :ping_interval, :ping_max
|
11
11
|
attr_accessor :varz, :healthz, :max_connections, :num_connections, :in_msgs, :out_msgs, :in_bytes, :out_bytes
|
12
12
|
|
@@ -75,6 +75,7 @@ module NATSD #:nodoc: all
|
|
75
75
|
end
|
76
76
|
|
77
77
|
setup_logs
|
78
|
+
open_syslog
|
78
79
|
|
79
80
|
# Setup optimized select versions
|
80
81
|
EM.epoll unless @options[:noepoll]
|
data/lib/nats/server/util.rb
CHANGED
@@ -5,17 +5,26 @@ def fast_uuid #:nodoc:
|
|
5
5
|
"%04x%04x%04x%04x%04x%06x" % v
|
6
6
|
end
|
7
7
|
|
8
|
+
def syslog(args, priority) #:nodoc:
|
9
|
+
Syslog::log(priority, '%s', PP::pp(args.compact, '', 120))
|
10
|
+
end
|
11
|
+
|
8
12
|
def log(*args) #:nodoc:
|
13
|
+
return syslog(args, Syslog::LOG_NOTICE) if NATSD::Server.syslog
|
9
14
|
args.unshift(Time.now) if NATSD::Server.log_time
|
10
15
|
PP::pp(args.compact, $stdout, 120)
|
11
16
|
end
|
12
17
|
|
13
18
|
def debug(*args) #:nodoc:
|
14
|
-
|
19
|
+
return unless NATSD::Server.debug_flag?
|
20
|
+
return syslog(args, Syslog::LOG_INFO) if NATSD::Server.syslog
|
21
|
+
log(*args)
|
15
22
|
end
|
16
23
|
|
17
24
|
def trace(*args) #:nodoc:
|
18
|
-
|
25
|
+
return unless NATSD::Server.trace_flag?
|
26
|
+
return syslog(args, Syslog::LOG_DEBUG) if NATSD::Server.syslog
|
27
|
+
log(*args)
|
19
28
|
end
|
20
29
|
|
21
30
|
def log_error(e=$!) #:nodoc:
|
@@ -56,6 +65,7 @@ end
|
|
56
65
|
def shutdown #:nodoc:
|
57
66
|
puts
|
58
67
|
log 'Server exiting..'
|
68
|
+
NATSD::Server.close_syslog
|
59
69
|
EM.stop
|
60
70
|
if NATSD::Server.pid_file
|
61
71
|
FileUtils.rm(NATSD::Server.pid_file) if File.exists? NATSD::Server.pid_file
|
data/nats.gemspec
CHANGED
@@ -19,7 +19,7 @@ spec = Gem::Specification.new do |s|
|
|
19
19
|
s.add_dependency('eventmachine', '>= 0.12.10')
|
20
20
|
s.add_dependency('json_pure', '>= 1.7.3')
|
21
21
|
s.add_dependency('daemons', '>= 1.1.5')
|
22
|
-
s.add_dependency('thin', '>= 1.
|
22
|
+
s.add_dependency('thin', '>= 1.4.1')
|
23
23
|
|
24
24
|
s.require_paths = ['lib']
|
25
25
|
s.bindir = 'bin'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.26
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 0.12.10
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.12.10
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: json_pure
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: 1.7.3
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.7.3
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: daemons
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,18 +53,28 @@ dependencies:
|
|
43
53
|
version: 1.1.5
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.1.5
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: thin
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
53
68
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
69
|
+
version: 1.4.1
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.4.1
|
58
78
|
description: A lightweight cloud messaging system.
|
59
79
|
email:
|
60
80
|
- derek.collison@gmail.com
|
@@ -112,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
132
|
version: '0'
|
113
133
|
requirements: []
|
114
134
|
rubyforge_project:
|
115
|
-
rubygems_version: 1.8.
|
135
|
+
rubygems_version: 1.8.24
|
116
136
|
signing_key:
|
117
137
|
specification_version: 3
|
118
138
|
summary: A lightweight cloud messaging system.
|