Sha256: 83bcb2b6c6d3cca8b1c5c162893d5c8531d14f4bba4ea0c5eeae9c1ccfab5d49

Contents?: true

Size: 969 Bytes

Versions: 3

Compression:

Stored size: 969 Bytes

Contents

# Base of Stomp Handler
# it handles connecting and subscribing to the stomp broker which
# is used in both stomp input and output
class LogStash::Stomp
  class Handler < EventMachine::Connection
    include EM::Protocols::Stomp

    def initialize(*args)
      super

      @input = args[0]
      @logger = args[1]
      @url = args[2]
    end # def initialize

    def connection_completed
      @logger.debug("Connected")
      connect :login => @url.user, :passcode => @url.password
    end # def connection_completed

    def unbind
      @logger.error(["Error when connecting to stomp broker", { :url => @url }])
    end # def unbind

    def receive_msg(message)
      @logger.debug(["receiving message", { :msg => message }])
      if message.command == "CONNECTED"
        @logger.debug(["subscribing to", { :path => @url.path }])
        subscribe @url.path
        return
      end
    end # def receive_msg
  end # class Handler
end # class LogStash::Stomp

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
logstash-lite-0.2.20101222161646 lib/logstash/stomp/handler.rb
logstash-lite-0.2.20101208111718 lib/logstash/stomp/handler.rb
logstash-lite-0.2.20101207114354 lib/logstash/stomp/handler.rb