Class: Cheetah::QueueListener

Inherits:
Object
  • Object
show all
Defined in:
lib/cheetah/services/queue_listener.rb

Instance Method Summary collapse

Instance Method Details

#listenObject



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/cheetah/services/queue_listener.rb', line 3

def listen
  stomp_client.subscribe(topic) do |msg|
    begin
      data = JSON.parse(msg.body)

      Cheetah::EventReceiver.receive!(data.to_h.with_indifferent_access)
    rescue StandardError => e
      puts "Um erro aconteceu!", e

      Honeybadger.notify(e) unless ENV['HONEYBADGER_API_KEY'].to_s.empty?
    end
  end
end