Class: LogStash::Outputs::Torquebox

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/outputs/torquebox.rb

Instance Method Summary collapse

Instance Method Details

#receive(event) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
# File 'lib/logstash/outputs/torquebox.rb', line 65

def receive(event)
   @logger.debug('Sending message to destination', event: event)

  begin
    @destination.publish(event.to_json, @publish_opts)
  rescue javax.jms.JMSException => e
    @logger.error("Torquebox destination is not available", exception: e)
  rescue => e
    @logger.error("Failed to send event #{event}", exception: e)
  end
end

#registerObject



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/logstash/outputs/torquebox.rb', line 51

def register
  require 'torquebox-messaging'

  @publish_opts = { encoding: @encoding, startup_timeout: @startup_timeout }

  @logger.info "TorqueBox #{@topology}:#{@name}@#{@host}:#{@port} - #{@publish_opts}"

  if @topology == 'topic'
    @destination = TorqueBox::Messaging::Topic.new(@name, host: @host, port: @port)
  else
    @destination = TorqueBox::Messaging::Queue.new(@name, host: @host, port: @port)
  end
end