Class: Fluent::Plugin::NSQInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fluent/plugin/in_nsq.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/fluent/plugin/in_nsq.rb', line 30

def configure(conf)
  super

  fail Fluent::ConfigError, 'Missing nsqlookupd' unless @nsqlookupd
  fail Fluent::ConfigError, 'Missing topic' unless @topic
  fail Fluent::ConfigError, 'Missing channel' unless @channel
  fail Fluent::ConfigError, 'in_flight needs to be bigger than 0' unless @in_flight > 0
end

#shutdownObject



51
52
53
54
55
# File 'lib/fluent/plugin/in_nsq.rb', line 51

def shutdown
  super
  @running = false
  @consumer.terminate
end

#startObject



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fluent/plugin/in_nsq.rb', line 39

def start
  super
  @consumer = Nsq::Consumer.new(
    nsqlookupd: @nsqlookupd,
    topic: @topic,
    channel: @channel,
    max_in_flight: @in_flight
  )
  @running = true
  @thread = Thread.new(&method(:consume))
end