nsq-cluster 2.0.0 → 2.2.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
- SHA1:
3
- metadata.gz: 4c7c5f98ff83cca318e2639e007161bd439b2316
4
- data.tar.gz: d7af273c0b9f9e74b700fd5a3fb22c676fdbccb9
2
+ SHA256:
3
+ metadata.gz: 888ca42c33599c1c905e2fe7277fb2c95f9bceaa02e3304e729b06309a9d6cc8
4
+ data.tar.gz: aaca00aaf0818575a178bb290a68cef339534212bc9b134b5a860912d0cd0185
5
5
  SHA512:
6
- metadata.gz: 11b7c8b3a6db1d70e72cd20117d5987bc2e880eac5f9783eae0bcceaa127e943f71cf771458ac9935012560674172879328a678b6398402b0fd4440a2d786488
7
- data.tar.gz: cb329273e0e9e6fbba661aebc397270c2e1f4eb4406f7a076f643c166d1ebfbf83479fe91715a321d2d8e6d03adf89e1c35c56b4eaf18b4a7fcf6e472db3a881
6
+ metadata.gz: 562184f09a1eca56b1aa8120498b425fd1289fc86a6fc616982f65e84e7882d247c0a0b0c926a3029c497023c3c68da3a87b0dbf2a706265b1ace6124ab006c4
7
+ data.tar.gz: 321ee7ce0f0c21f24e707f6379867e4e3ead0172b14cef40824e0001d24ad45f41d023d5dac06522a9c579c5f243b7e36062ac3a5e48ffd62dc66cd9c2bb9615
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
@@ -100,6 +100,7 @@ class ProcessWrapper
100
100
  def http_port_open?
101
101
  begin
102
102
  response = Net::HTTP.get_response(URI("http://#{host}:#{http_port}/ping"))
103
+
103
104
  return response.is_a?(Net::HTTPSuccess)
104
105
  rescue Errno::ECONNREFUSED
105
106
  return false
metadata CHANGED
@@ -1,57 +1,29 @@
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.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wistia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2017-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sys-proctable
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: fakeweb
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
19
  version: '1.3'
34
- type: :development
20
+ type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - "~>"
39
25
  - !ruby/object:Gem::Version
40
26
  version: '1.3'
41
- - !ruby/object:Gem::Dependency
42
- name: jeweler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '2.2'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '2.2'
55
27
  - !ruby/object:Gem::Dependency
56
28
  name: rspec
57
29
  requirement: !ruby/object:Gem::Requirement
@@ -88,7 +60,7 @@ homepage: http://github.com/wistia/nsq-cluster
88
60
  licenses:
89
61
  - MIT
90
62
  metadata: {}
91
- post_install_message:
63
+ post_install_message:
92
64
  rdoc_options: []
93
65
  require_paths:
94
66
  - lib
@@ -103,9 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
75
  - !ruby/object:Gem::Version
104
76
  version: '0'
105
77
  requirements: []
106
- rubyforge_project:
107
- rubygems_version: 2.6.8
108
- signing_key:
78
+ rubygems_version: 3.4.10
79
+ signing_key:
109
80
  specification_version: 4
110
81
  summary: Easily setup and manage a local NSQ cluster
111
82
  test_files: []