Method: RosettaQueue::Gateway::StompAdapter#receive_with

Defined in:
lib/rosetta_queue/adapters/stomp.rb

#receive_with(message_handler) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rosetta_queue/adapters/stomp.rb', line 35

def receive_with(message_handler)
  options = options_for(message_handler)
  destination = destination_for(message_handler)
  @conn.subscribe(destination, options)

  running do
    msg = receive(options).body
    Thread.current[:processing] = true
    RosettaQueue.logger.info("Receiving from #{destination} :: #{msg}")
    message_handler.on_message(filter_receiving(msg))
    Thread.current[:processing] = false
  end
end