Class: Fluent::Plugin::GroongaInput
- Inherits:
-
Input
- Object
- Input
- Fluent::Plugin::GroongaInput
show all
- Defined in:
- lib/fluent/plugin/in_groonga.rb
Defined Under Namespace
Classes: BaseInput, GQTPInput, HTTPInput, Repeater
Instance Method Summary
collapse
Constructor Details
Returns a new instance of GroongaInput.
34
35
36
|
# File 'lib/fluent/plugin/in_groonga.rb', line 34
def initialize
super
end
|
Instance Method Details
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/fluent/plugin/in_groonga.rb', line 40
def configure(conf)
super
case @protocol
when :http
@input = HTTPInput.new(self)
when :gqtp
@input = GQTPInput.new(self)
end
@input.configure(conf)
end
|
#multi_workers_ready? ⇒ Boolean
93
94
95
|
# File 'lib/fluent/plugin/in_groonga.rb', line 93
def multi_workers_ready?
true
end
|
#shutdown ⇒ Object
89
90
91
|
# File 'lib/fluent/plugin/in_groonga.rb', line 89
def shutdown
super
end
|
#start ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/fluent/plugin/in_groonga.rb', line 51
def start
super
port = @input.port
bind = @input.bind
log.info("[input][groonga][connect] listening port",
:port => port, :bind => bind)
server_create_connection(:groonga_input,
port,
:proto => :tcp,
:shared => system_config.workers > 1,
:bind => bind) do |connection|
handler = nil
real_host = @input.real_host
real_port = @input.real_port
repeater = Coolio::TCPSocket.connect(real_host, real_port)
repeater.on_connect_failed do
log.error("[input][groonga][connect][error] " +
"failed to connect to Groonga:",
:real_host => real_host,
:real_port => real_port)
connection.close
end
repeater.on_read do |data|
handler.write_back(data)
end
repeater.on_close do
handler.close
end
event_loop_attach(repeater)
handler = @input.create_handler(connection, repeater)
connection.data do |data|
handler.on_read(data)
end
end
end
|