nsq-cluster 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -5
- data/lib/nsq-cluster/nsqd.rb +14 -2
- data/lib/nsq-cluster/nsqlookupd.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c0bd6539d3271fa6911e7eb433dd42654c823d4
|
4
|
+
data.tar.gz: '08bd687fbf33c404332e8e35397298281f3e1421'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6503b58025c3130da593fd7a3764126dfe72eb0ab0893b69d387617c3d405cd91507414e4c06f8646280ab9d239ef8173a915533bd9317068f86b043f9f129d6
|
7
|
+
data.tar.gz: e08ee4e576dd6543dfcb1b9f1b39b3b90233a0e1e54628d45d917c910eb519440c2c92be5def920b7f1f9079725ebbdd8917071e57065af2fafcab9dcb9da343
|
data/README.md
CHANGED
@@ -17,11 +17,6 @@ cluster.nsqd.last.start
|
|
17
17
|
cluster.destroy
|
18
18
|
```
|
19
19
|
|
20
|
-
## Compatibility
|
21
|
-
|
22
|
-
- Version 2.x of `nsq-cluster` is compatible with NSQ >= 1.0.
|
23
|
-
- Version 1.x of `nsq-cluster` is compatible with NSQ < 1.0.
|
24
|
-
|
25
20
|
## Flags for nsqd and nsqlookupd
|
26
21
|
|
27
22
|
Optionally, you can pass in flags for nsqd and nsqlookupd like this:
|
data/lib/nsq-cluster/nsqd.rb
CHANGED
@@ -8,6 +8,13 @@ class Nsqd < ProcessWrapper
|
|
8
8
|
|
9
9
|
attr_reader :host, :tcp_port, :http_port, :id, :base_port
|
10
10
|
|
11
|
+
# Returns true if nsqd's version is < 1.0
|
12
|
+
def self.version_is_pre_1?
|
13
|
+
@version_is_pre_1 ||= (
|
14
|
+
`nsqd -version`.index('nsqd v0') == 0
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
11
18
|
|
12
19
|
def initialize(opts = {}, verbose = false)
|
13
20
|
super
|
@@ -49,15 +56,20 @@ class Nsqd < ProcessWrapper
|
|
49
56
|
%Q(--tcp-address=#{@host}:#{@tcp_port}),
|
50
57
|
%Q(--http-address=#{@host}:#{@http_port}),
|
51
58
|
%Q(--data-path=#{data_path}),
|
52
|
-
%Q(--node-id=#{id}),
|
53
59
|
%Q(--broadcast-address=#{@broadcast_address})
|
54
60
|
]
|
55
61
|
|
62
|
+
if Nsqd.version_is_pre_1?
|
63
|
+
node_args = [%Q(--worker-id=#{id})]
|
64
|
+
else
|
65
|
+
node_args = [%Q(--node-id=#{id})]
|
66
|
+
end
|
67
|
+
|
56
68
|
lookupd_args = @lookupd.map do |ld|
|
57
69
|
%Q(--lookupd-tcp-address=#{ld.host}:#{ld.tcp_port})
|
58
70
|
end
|
59
71
|
|
60
|
-
base_args + @extra_args + lookupd_args
|
72
|
+
base_args + node_args + @extra_args + lookupd_args
|
61
73
|
end
|
62
74
|
|
63
75
|
|
@@ -87,9 +87,9 @@ class Nsqlookupd < ProcessWrapper
|
|
87
87
|
|
88
88
|
def nsqlookupd_post(action, params)
|
89
89
|
if params[:topic] && params[:channel]
|
90
|
-
post "
|
90
|
+
post "#{action}_channel", topic: params[:topic], channel: params[:channel]
|
91
91
|
elsif params[:topic]
|
92
|
-
post "
|
92
|
+
post "#{action}_topic", topic: params[:topic]
|
93
93
|
else
|
94
94
|
raise 'you must specify a topic or topic and channel'
|
95
95
|
end
|