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
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
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/fluent/plugin/in_groonga.rb', line 41
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
96
97
98
|
# File 'lib/fluent/plugin/in_groonga.rb', line 96
def multi_workers_ready?
true
end
|
#shutdown ⇒ Object
92
93
94
|
# File 'lib/fluent/plugin/in_groonga.rb', line 92
def shutdown
super
end
|
#start ⇒ Object
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
88
89
90
|
# File 'lib/fluent/plugin/in_groonga.rb', line 52
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
connection.on(:write_complete) do
handler.close
end
end
event_loop_attach(repeater)
handler = @input.create_handler(connection, repeater)
connection.data do |data|
handler.on_read(data)
end
end
end
|