Class: Fluent::Plugin::GroongaOutput::NetworkClient
- Inherits:
-
BaseClient
- Object
- BaseClient
- Fluent::Plugin::GroongaOutput::NetworkClient
- Includes:
- Configurable
- Defined in:
- lib/fluent/plugin/out_groonga.rb
Instance Method Summary collapse
- #execute(name, arguments = {}) ⇒ Object
-
#initialize(protocol, output_plugin) ⇒ NetworkClient
constructor
A new instance of NetworkClient.
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(protocol, output_plugin) ⇒ NetworkClient
Returns a new instance of NetworkClient.
629 630 631 632 633 |
# File 'lib/fluent/plugin/out_groonga.rb', line 629 def initialize(protocol, output_plugin) super() @protocol = protocol @output_plugin = output_plugin end |
Instance Method Details
#execute(name, arguments = {}) ⇒ Object
644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 |
# File 'lib/fluent/plugin/out_groonga.rb', line 644 def execute(name, arguments={}) command = build_command(name, arguments) @client ||= Groonga::Client.new(:protocol => @protocol, :host => @host, :port => @port, :backend => :synchronous) 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.) end response end |
#shutdown ⇒ Object
639 640 641 642 |
# File 'lib/fluent/plugin/out_groonga.rb', line 639 def shutdown return if @client.nil? @client.close end |
#start ⇒ Object
635 636 637 |
# File 'lib/fluent/plugin/out_groonga.rb', line 635 def start @client = nil end |