class Fluent::Plugin::FestivalInput
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_festival.rb, line 65 def configure(conf) super end
emit(record)
click to toggle source
Sample data from FESTIVAL IoT Gateway (sensinact) time_key must be set to “date” {“dataValue”: “1017.57”, “date”: “2017-03-29T16:19:15Z”}
# File lib/fluent/plugin/in_festival.rb, line 87 def emit(record) begin time = Fluent::EventTime.now if record.is_a?(Array) # Multiple values case mes = Fluent::MultiEventStream.new record.each do |single_record| # use timestamp of the first sensor (single_record[0]) mes.add(time, single_record) end router.emit_stream(@tag, mes) else # Single value case # use timestamp of the first sensor (single_record[0]) router.emit(@tag, time, record) end rescue Exception => e log.error error: e.to_s log.debug_backtrace(e.backtrace) end end
shutdown()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_festival.rb, line 107 def shutdown shutdown_proxy super end
start()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_festival.rb, line 69 def start #raise StandardError.new if @tag.nil? super start_proxy timer_execute(:in_festival, @polling_interval) do begin data = get_data emit(data) if !(data.nil? || data.empty?) rescue Exception => e log.error error: e.to_s log.debug_backtrace(e.backtrace) end end end