Class: Fluent::NSQInput
- Inherits:
-
Input
- Object
- Input
- Fluent::NSQInput
- Defined in:
- lib/fluent/plugin/in_nsq.rb
Instance Method Summary collapse
- #configure(conf) ⇒ Object
-
#initialize ⇒ NSQInput
constructor
A new instance of NSQInput.
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize ⇒ NSQInput
Returns a new instance of NSQInput.
25 26 27 28 29 |
# File 'lib/fluent/plugin/in_nsq.rb', line 25 def initialize super require 'cool.io' require 'nsq' end |
Instance Method Details
#configure(conf) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/fluent/plugin/in_nsq.rb', line 31 def configure(conf) super fail ConfigError, 'Missing nsqlookupd' unless @nsqlookupd fail ConfigError, 'Missing topic' unless @topic fail ConfigError, 'Missing channel' unless @channel end |
#shutdown ⇒ Object
51 52 53 54 55 |
# File 'lib/fluent/plugin/in_nsq.rb', line 51 def shutdown super @running = false @consumer.terminate end |
#start ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fluent/plugin/in_nsq.rb', line 39 def start super lookupds = @nsqlookupd.split(',') @consumer = Nsq::Consumer.new( nsqlookupd: lookupds, topic: @topic, channel: @channel ) @running = true @thread = Thread.new(&method(:consume)) end |