Class: Nsqlookupd
- Inherits:
-
ProcessWrapper
- Object
- ProcessWrapper
- Nsqlookupd
- Includes:
- HTTPWrapper
- Defined in:
- lib/nsq-cluster/nsqlookupd.rb
Constant Summary
Constants inherited from ProcessWrapper
ProcessWrapper::HTTPCHECK_INTERVAL
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#http_port ⇒ Object
readonly
Returns the value of attribute http_port.
-
#tcp_port ⇒ Object
readonly
Returns the value of attribute tcp_port.
Attributes inherited from ProcessWrapper
Instance Method Summary collapse
- #args ⇒ Object
-
#channels(topic) ⇒ Object
return a list of all known channels for a topic.
- #command ⇒ Object
-
#delete(params = {}) ⇒ Object
delete a topic or a channel in an existing topic.
-
#info ⇒ Object
returns version number.
-
#initialize(opts = {}, verbose = false) ⇒ Nsqlookupd
constructor
A new instance of Nsqlookupd.
-
#lookup(topic) ⇒ Object
return a list of producers for a topic.
-
#nodes ⇒ Object
return a list of all known nsqd.
-
#ping ⇒ Object
monitoring endpoint.
-
#topics ⇒ Object
return a list of all known topics.
Methods included from HTTPWrapper
Methods inherited from ProcessWrapper
#another_instance_is_running?, #block_until_running, #block_until_stopped, #destroy, #output, #running?, #start, #stop
Constructor Details
#initialize(opts = {}, verbose = false) ⇒ Nsqlookupd
Returns a new instance of Nsqlookupd.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/nsq-cluster/nsqlookupd.rb', line 9 def initialize(opts = {}, verbose = false) super @host = opts.delete(:host) || '127.0.0.1' @tcp_port = opts.delete(:tcp_port) || 4160 @http_port = opts.delete(:http_port) || 4161 @broadcast_address = opts.delete(:broadcast_address) || @host @extra_args = opts.map do |key, value| "--#{key.to_s.gsub('_', '-')}=#{value}" end end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
7 8 9 |
# File 'lib/nsq-cluster/nsqlookupd.rb', line 7 def host @host end |
#http_port ⇒ Object (readonly)
Returns the value of attribute http_port.
7 8 9 |
# File 'lib/nsq-cluster/nsqlookupd.rb', line 7 def http_port @http_port end |
#tcp_port ⇒ Object (readonly)
Returns the value of attribute tcp_port.
7 8 9 |
# File 'lib/nsq-cluster/nsqlookupd.rb', line 7 def tcp_port @tcp_port end |
Instance Method Details
#args ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/nsq-cluster/nsqlookupd.rb', line 28 def args [ %Q(--tcp-address=#{@host}:#{@tcp_port}), %Q(--http-address=#{@host}:#{@http_port}), %Q(--broadcast-address=#{@broadcast_address}) ] + @extra_args end |
#channels(topic) ⇒ Object
return a list of all known channels for a topic
50 51 52 |
# File 'lib/nsq-cluster/nsqlookupd.rb', line 50 def channels(topic) get 'channels', topic: topic end |
#command ⇒ Object
23 24 25 |
# File 'lib/nsq-cluster/nsqlookupd.rb', line 23 def command 'nsqlookupd' end |
#delete(params = {}) ⇒ Object
delete a topic or a channel in an existing topic
62 63 64 |
# File 'lib/nsq-cluster/nsqlookupd.rb', line 62 def delete(params = {}) nsqlookupd_post 'delete', topic: params[:topic], channel: params[:channel] end |
#info ⇒ Object
returns version number
74 75 76 |
# File 'lib/nsq-cluster/nsqlookupd.rb', line 74 def info get 'info' end |
#lookup(topic) ⇒ Object
return a list of producers for a topic
38 39 40 |
# File 'lib/nsq-cluster/nsqlookupd.rb', line 38 def lookup(topic) get 'lookup', topic: topic end |
#nodes ⇒ Object
return a list of all known nsqd
56 57 58 |
# File 'lib/nsq-cluster/nsqlookupd.rb', line 56 def nodes get 'nodes' end |
#ping ⇒ Object
monitoring endpoint
68 69 70 |
# File 'lib/nsq-cluster/nsqlookupd.rb', line 68 def ping get 'ping' end |
#topics ⇒ Object
return a list of all known topics
44 45 46 |
# File 'lib/nsq-cluster/nsqlookupd.rb', line 44 def topics get 'topics' end |