Class: LogStash::Inputs::Stomp

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/inputs/stomp.rb

Overview

Creates events received with the STOMP protocol.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clientObject

Returns the value of attribute client.



8
9
10
# File 'lib/logstash/inputs/stomp.rb', line 8

def client
  @client
end

Instance Method Details

#new_clientObject

def register



70
71
72
# File 'lib/logstash/inputs/stomp.rb', line 70

def new_client
  OnStomp::Client.new("stomp://#{@host}:#{@port}", :login => @user, :passcode => @password.value)
end

#registerObject



62
63
64
65
66
67
68
# File 'lib/logstash/inputs/stomp.rb', line 62

def register
  require "onstomp"
  
  @client = new_client
  @client.host = @vhost if @vhost
  @stomp_url = "stomp://#{@user}:#{@password}@#{@host}:#{@port}/#{@destination}"
end

#run(output_queue) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
# File 'lib/logstash/inputs/stomp.rb', line 97

def run(output_queue)
  # Handle disconnects
  @client.on_connection_closed {
    self.connect
    subscription_handler # is required for re-subscribing to the destination
  }

  connect
  @output_queue = output_queue
  subscription_handler
end

#stopObject

def run



109
110
111
# File 'lib/logstash/inputs/stomp.rb', line 109

def stop
  @client.disconnect if @client && @client.connected?
end