class LogStash::Outputs::Stomp

Public Instance Methods

receive(event) click to toggle source
# File lib/logstash/outputs/stomp.rb, line 61
def receive(event)
    return unless output?(event)

    @logger.debug(["stomp sending event", { :host => @host, :event => event }])
    @client.send(event.sprintf(@destination), event.to_json)
end
register() click to toggle source
# File lib/logstash/outputs/stomp.rb, line 48
def register
  require "onstomp"
  @client = OnStomp::Client.new("stomp://#{@host}:#{@port}", :login => @user, :passcode => @password.value)
  @client.host = @vhost if @vhost

  # Handle disconnects
  @client.on_connection_closed {
    connect
  }
  
  connect
end

Private Instance Methods

connect() click to toggle source
# File lib/logstash/outputs/stomp.rb, line 34
def connect
  begin
    @client.connect
    @logger.debug("Connected to stomp server") if @client.connected?
  rescue => e
    @logger.debug("Failed to connect to stomp server, will retry",
                  :exception => e, :backtrace => e.backtrace)
    sleep 2
    retry
  end
end