Class: Fluent::Plugin::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, output_plugin) ⇒ NetworkClient

Returns a new instance of NetworkClient.



624
625
626
627
628
# File 'lib/fluent/plugin/out_groonga.rb', line 624

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

Instance Method Details

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



636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
# File 'lib/fluent/plugin/out_groonga.rb', line 636

def execute(name, arguments={})
  command = build_command(name, arguments)
  Groonga::Client.open(:protocol => @protocol,
                       :host     => @host,
                       :port     => @port,
                       :backend  => :synchronous) do |client|
    response = nil
    begin
      response = client.execute(command)
    rescue Groonga::Client::Error
      @output_plugin.log.error("[output][groonga][error]",
                               :protocol => @protocol,
                               :host => @host,
                               :port => @port,
                               :command_name => name)
      raise
    end
    unless response.success?
      @output_plugin.log.error("[output][groonga][error]",
                               :status_code => response.status_code,
                               :message => response.message)
    end
    response
  end
end

#shutdownObject



633
634
# File 'lib/fluent/plugin/out_groonga.rb', line 633

def shutdown
end

#startObject



630
631
# File 'lib/fluent/plugin/out_groonga.rb', line 630

def start
end