Class: Fluent::GroongaOutput::NetworkClient
- Inherits:
-
BaseClient
- Object
- BaseClient
- Fluent::GroongaOutput::NetworkClient
- Includes:
- Configurable
- Defined in:
- lib/fluent/plugin/out_groonga.rb
Instance Method Summary collapse
- #execute(name, arguments = {}) ⇒ Object
-
#initialize(protocol) ⇒ NetworkClient
constructor
A new instance of NetworkClient.
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(protocol) ⇒ NetworkClient
Returns a new instance of NetworkClient.
602 603 604 605 |
# File 'lib/fluent/plugin/out_groonga.rb', line 602 def initialize(protocol) super() @protocol = protocol end |
Instance Method Details
#execute(name, arguments = {}) ⇒ Object
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 |
# File 'lib/fluent/plugin/out_groonga.rb', line 616 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 $log.error("[output][groonga][error]", :protocol => @protocol, :host => @host, :port => @port, :command_name => name) raise end unless response.success? $log.error("[output][groonga][error]", :status_code => response.status_code, :message => response.) end response end |
#shutdown ⇒ Object
611 612 613 614 |
# File 'lib/fluent/plugin/out_groonga.rb', line 611 def shutdown return if @client.nil? @client.close end |
#start ⇒ Object
607 608 609 |
# File 'lib/fluent/plugin/out_groonga.rb', line 607 def start @client = nil end |