Class: Fluent::GroongaOutput::NetworkClient

Inherits:
BaseClient
  • Object
show all
Includes:
Configurable
Defined in:
lib/fluent/plugin/out_groonga.rb

Instance Method Summary collapse

Constructor Details

#initialize(protocol) ⇒ NetworkClient

Returns a new instance of NetworkClient.



566
567
568
569
# File 'lib/fluent/plugin/out_groonga.rb', line 566

def initialize(protocol)
  super()
  @protocol = protocol
end

Instance Method Details

#execute(name, arguments = {}) ⇒ Object



580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/fluent/plugin/out_groonga.rb', line 580

def execute(name, arguments={})
  command = build_command(name, arguments)
  @client ||= Groonga::Client.new(:protocol => @protocol,
                                  :host     => @host,
                                  :port     => @port,
                                  :backend  => :synchronous)
  response = @client.execute(command)
  unless response.success?
    $log.error("[output][groonga][error]",
               :status_code => response.status_code,
               :message => response.message)
  end
  response
end

#shutdownObject



575
576
577
578
# File 'lib/fluent/plugin/out_groonga.rb', line 575

def shutdown
  return if @client.nil?
  @client.close
end

#startObject



571
572
573
# File 'lib/fluent/plugin/out_groonga.rb', line 571

def start
  @client = nil
end