Class: Fluent::Plugin::SforceInput
- Inherits:
-
Input
- Object
- Input
- Fluent::Plugin::SforceInput
show all
- Defined in:
- lib/fluent/plugin/in_sforce.rb
Defined Under Namespace
Classes: SforceConnectionError
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
26
27
28
|
# File 'lib/fluent/plugin/in_sforce.rb', line 26
def client
@client
end
|
Instance Method Details
28
29
30
|
# File 'lib/fluent/plugin/in_sforce.rb', line 28
def configure(conf)
super
end
|
#shutdown ⇒ Object
68
69
70
|
# File 'lib/fluent/plugin/in_sforce.rb', line 68
def shutdown
super
end
|
#start ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/fluent/plugin/in_sforce.rb', line 32
def start
super
@client = generate_client
if @topic == nil
start_at = now
loop do
sleep(@polling_interval)
end_at = now
soql = build_query(start_at, end_at)
begin
log.info "query: #{soql}"
records = exec_query(soql)
records.each do |record|
router.emit(@tag, Fluent::Engine.now, record)
end
start_at = end_at
rescue Restforce::UnauthorizedError => e
log.error e
@client = generate_client
end
end
else
EM.run do
log.info "suscribe: #{@topic}"
subscribe @topic do |message|
router.emit(@tag, Fluent::Engine.now, message)
end
end
end
rescue SforceConnectionError => e
log.error e.message
end
|