Class: Fluent::YammerOutput

Inherits:
Output
  • Object
show all
Defined in:
lib/fluent/plugin/out_yammer.rb

Instance Method Summary collapse

Constructor Details

#initializeYammerOutput

Returns a new instance of YammerOutput.



8
9
10
11
# File 'lib/fluent/plugin/out_yammer.rb', line 8

def initialize
  super
  require 'yammer'
end

Instance Method Details

#configure(conf) ⇒ Object



13
14
15
16
17
# File 'lib/fluent/plugin/out_yammer.rb', line 13

def configure(conf)
  super
  @yammer = Yammer::Client.new(:access_token => conf['access_token'])
  @group_id = conf['group_id']
end

#create_message(message) ⇒ Object



27
28
29
30
31
# File 'lib/fluent/plugin/out_yammer.rb', line 27

def create_message(message)
  @yammer.create_message(message, :group_id => @group_id)
rescue Yammer::Error => e
  $log.error("Yammer Error: #{e.message}")
end

#emit(tag, es, chain) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/fluent/plugin/out_yammer.rb', line 19

def emit(tag, es, chain)
  es.each do |time, record|
    create_message(record['message'])
  end

  chain.next
end