class FastlyNsq::Http::Nsqlookupd

Provides an interface to the functionality exposed by the nsqlookupd HTTP interface

@see nsq.io/components/nsqlookupd.html

Constants

BASE_NSQLOOKUPD_URL

Attributes

client[RW]

Public Class Methods

channels(topic:, **args) click to toggle source

List of channels for a given topic

@param topic [String] the topic for which to list channels

# File lib/fastly_nsq/http/nsqlookupd.rb, line 35
def self.channels(topic:, **args)
  new(request_uri: '/channels', **args).get(topic: topic)
end
delete_channel(topic:, channel:, **args) click to toggle source

Deletes an existing channel of an existing topic

@param topic [String] an exsiting topic @param channel [String] the exsiting channel to delete

# File lib/fastly_nsq/http/nsqlookupd.rb, line 58
def self.delete_channel(topic:, channel:, **args)
  new(request_uri: '/delete_channel', **args).get(topic: topic, channel: channel)
end
delete_topic(topic:, **args) click to toggle source

Deletes an existing topic

@param topic [String] the exsiting topic to delete

# File lib/fastly_nsq/http/nsqlookupd.rb, line 49
def self.delete_topic(topic:, **args)
  new(request_uri: '/delete_topic', **args).get(topic: topic)
end
info(**args) click to toggle source

Returns nsqlookupd version information

# File lib/fastly_nsq/http/nsqlookupd.rb, line 81
def self.info(**args)
  new(request_uri: '/info', **args).get
end
lookup(topic:, **args) click to toggle source

List of producers for a given topic

@param topic [String] the topic for which to list producers

# File lib/fastly_nsq/http/nsqlookupd.rb, line 21
def self.lookup(topic:, **args)
  new(request_uri: '/lookup', **args).get(topic: topic)
end
new(request_uri:, base_uri: BASE_NSQLOOKUPD_URL, adapter: FastlyNsq::Http) click to toggle source

Nsqlookupd http wrapper. Provides a simple interface to all NSQlookupd http api's @see nsq.io/components/nsqlookupd.html

@attr [String] request_uri the request you would like to call ie: '/thing' @attr [String] base_uri the host, port, and protocol of your nsqd @attr [Object] adapter the http adapter you would like to use…

# File lib/fastly_nsq/http/nsqlookupd.rb, line 92
def initialize(request_uri:, base_uri: BASE_NSQLOOKUPD_URL, adapter: FastlyNsq::Http)
  @adapter = adapter
  @base_uri = base_uri
  uri = URI.join(@base_uri, request_uri)

  @client = @adapter.new(uri: uri)
end
nodes(**args) click to toggle source

List all known nsqd nodes

# File lib/fastly_nsq/http/nsqlookupd.rb, line 41
def self.nodes(**args)
  new(request_uri: '/nodes', **args).get
end
ping(**args) click to toggle source

Monitoring endpoint, should return OK

# File lib/fastly_nsq/http/nsqlookupd.rb, line 75
def self.ping(**args)
  new(request_uri: '/ping', **args).get
end
tombstone_topic_producer(topic:, node:, **args) click to toggle source

Tombstones a specific producer of an existing topic

@see nsq.io/components/nsqlookupd.html#deletion_tombstones

@param topic [String] the existing topic @param node [String] the producer (nsqd) to tombstone (identified by <broadcast_address>:<http_port>)

# File lib/fastly_nsq/http/nsqlookupd.rb, line 69
def self.tombstone_topic_producer(topic:, node:, **args)
  new(request_uri: '/tombstone_topic_producer', **args).get(topic: topic, node: node)
end
topics(**args) click to toggle source

List of all known topics

# File lib/fastly_nsq/http/nsqlookupd.rb, line 27
def self.topics(**args)
  new(request_uri: '/topics', **args).get
end