nsq-cluster 2.0.0 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c7c5f98ff83cca318e2639e007161bd439b2316
4
- data.tar.gz: d7af273c0b9f9e74b700fd5a3fb22c676fdbccb9
3
+ metadata.gz: 9c0bd6539d3271fa6911e7eb433dd42654c823d4
4
+ data.tar.gz: '08bd687fbf33c404332e8e35397298281f3e1421'
5
5
  SHA512:
6
- metadata.gz: 11b7c8b3a6db1d70e72cd20117d5987bc2e880eac5f9783eae0bcceaa127e943f71cf771458ac9935012560674172879328a678b6398402b0fd4440a2d786488
7
- data.tar.gz: cb329273e0e9e6fbba661aebc397270c2e1f4eb4406f7a076f643c166d1ebfbf83479fe91715a321d2d8e6d03adf89e1c35c56b4eaf18b4a7fcf6e472db3a881
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:
@@ -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 "channel/#{action}", topic: params[:topic], channel: params[:channel]
90
+ post "#{action}_channel", topic: params[:topic], channel: params[:channel]
91
91
  elsif params[:topic]
92
- post "topic/#{action}", topic: params[:topic]
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nsq-cluster
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wistia