class LogStash::Stomp::Handler
Attributes
ready[RW]
should_subscribe[RW]
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/logstash/stomp/handler.rb, line 14 def initialize(*args) super @input = args[0] @logger = args[1] @url = args[2] @should_subscribe = true @ready = false end
Public Instance Methods
connection_completed()
click to toggle source
# File lib/logstash/stomp/handler.rb, line 25 def connection_completed @logger.debug("Connected") connect :login => @url.user, :passcode => @url.password @ready = true end
receive_msg(message)
click to toggle source
# File lib/logstash/stomp/handler.rb, line 47 def receive_msg(message) @logger.debug(["receiving message", { :msg => message }]) if message.command == "CONNECTED" if @should_subscribe @logger.debug(["subscribing to", { :path => @url.path }]) subscribe @url.path return end @ready = true end end
unbind()
click to toggle source
# File lib/logstash/stomp/handler.rb, line 32 def unbind if $EVENTMACHINE_STOPPING @logger.debug(["Connection to stomp broker died (probably since we are exiting)", { :url => @url }]) return end @logger.error(["Connection to stomp broker died, retrying.", { :url => @url }]) @ready = false EventMachine::Timer.new(1) do reconnect(@url.host, @url.port) end end