Class: FastlyNsq::Http::Nsqlookupd
- Inherits:
-
Object
- Object
- FastlyNsq::Http::Nsqlookupd
- Extended by:
- Forwardable
- Defined in:
- lib/fastly_nsq/http/nsqlookupd.rb
Overview
Provides an interface to the functionality exposed by the nsqlookupd HTTP interface
Constant Summary collapse
- BASE_NSQLOOKUPD_URL =
"http://#{ENV.fetch("NSQLOOKUPD_HTTP_ADDRESS", "").split(",")[0]}"
Class Method Summary collapse
-
.channels(topic:, **args) ⇒ Object
List of channels for a given topic.
-
.delete_channel(topic:, channel:, **args) ⇒ Object
Deletes an existing channel of an existing topic.
-
.delete_topic(topic:, **args) ⇒ Object
Deletes an existing topic.
-
.info(**args) ⇒ Object
Returns nsqlookupd version information.
-
.lookup(topic:, **args) ⇒ Object
List of producers for a given topic.
-
.nodes(**args) ⇒ Object
List all known nsqd nodes.
-
.ping(**args) ⇒ Object
Monitoring endpoint, should return
OK
. -
.tombstone_topic_producer(topic:, node:, **args) ⇒ Object
Tombstones a specific producer of an existing topic.
-
.topics(**args) ⇒ Object
List of all known topics.
Instance Method Summary collapse
-
#initialize(request_uri:, base_uri: BASE_NSQLOOKUPD_URL, adapter: FastlyNsq::Http) ⇒ Nsqlookupd
constructor
Nsqlookupd http wrapper.
Constructor Details
#initialize(request_uri:, base_uri: BASE_NSQLOOKUPD_URL, adapter: FastlyNsq::Http) ⇒ Nsqlookupd
Nsqlookupd http wrapper. Provides a simple interface to all NSQlookupd http api’s
92 93 94 95 96 97 98 |
# 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 |
Class Method Details
.channels(topic:, **args) ⇒ Object
List of channels for a given topic
35 36 37 |
# 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) ⇒ Object
Deletes an existing channel of an existing topic
58 59 60 |
# 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) ⇒ Object
Deletes an existing topic
49 50 51 |
# 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) ⇒ Object
Returns nsqlookupd version information
81 82 83 |
# File 'lib/fastly_nsq/http/nsqlookupd.rb', line 81 def self.info(**args) new(request_uri: "/info", **args).get end |
.lookup(topic:, **args) ⇒ Object
List of producers for a given topic
21 22 23 |
# File 'lib/fastly_nsq/http/nsqlookupd.rb', line 21 def self.lookup(topic:, **args) new(request_uri: "/lookup", **args).get(topic: topic) end |
.nodes(**args) ⇒ Object
List all known nsqd nodes
41 42 43 |
# File 'lib/fastly_nsq/http/nsqlookupd.rb', line 41 def self.nodes(**args) new(request_uri: "/nodes", **args).get end |
.ping(**args) ⇒ Object
Monitoring endpoint, should return OK
75 76 77 |
# 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) ⇒ Object
Tombstones a specific producer of an existing topic
69 70 71 |
# 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) ⇒ Object
List of all known topics
27 28 29 |
# File 'lib/fastly_nsq/http/nsqlookupd.rb', line 27 def self.topics(**args) new(request_uri: "/topics", **args).get end |