class Fluent::RedoopOutput

Public Instance Methods

configure(conf) click to toggle source

This method is called before starting.

Calls superclass method
# File lib/fluent/plugin/out_redoop.rb, line 9
def configure(conf)
  super

  @redis = Redis.new(:host => "127.0.0.1", :port => 6379)

  params = {}
  params["key_1"] = conf["key_1"]
  params["key_2"] = conf["key_2"]

  puts "*********"
  puts params
  puts "*********"
end
emit(tag, es, chain) click to toggle source

This method is called when an event reaches Fluentd. ‘es’ is a Fluent::EventStream object that includes multiple events. You can use ‘es.each {|time,record| … }’ to retrieve events. ‘chain’ is an object that manages transactions. Call ‘chain.next’ at appropriate points and rollback if it raises an exception.

# File lib/fluent/plugin/out_redoop.rb, line 38
def emit(tag, es, chain)
  chain.next
  es.each {|time,record|
    score = Time.now.to_i
    @redis.zadd tag, score, record.to_json
    @redis.publish "mathematica", record.to_json
    # puts record
    $stderr.puts "OK!"
  }
end
shutdown() click to toggle source

This method is called when shutting down.

Calls superclass method
# File lib/fluent/plugin/out_redoop.rb, line 29
def shutdown
  super
end
start() click to toggle source

This method is called when starting.

Calls superclass method
# File lib/fluent/plugin/out_redoop.rb, line 24
def start
  super
end