class Fluent::SlackRTMInput

Public Instance Methods

emit(data) click to toggle source
# File lib/fluent/plugin/in_slackrtm.rb, line 28
def emit(data)
  time = Time.now.to_i
  Fluent::Engine.emit(tag, time, data)
end
shutdown() click to toggle source
# File lib/fluent/plugin/in_slackrtm.rb, line 24
def shutdown
  Thread.kill(@messages_thread)
end
start() click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_slackrtm.rb, line 11
def start
  super
  @messages_thread = Thread.new do
    url = SlackRTM.get_url token: token
    client = SlackRTM::Client.new websocket_url: url
    client.on(:message) do |data|
      emit(data)
    end
    client.main_loop
  end
  @messages_thread.abort_on_exception = true
end