Class: RosettaQueue::EventedManager
Instance Attribute Summary
Attributes inherited from BaseManager
#consumers
Instance Method Summary
collapse
Methods inherited from BaseManager
#add, create, #initialize
Instance Method Details
#start ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/rosetta_queue/consumer_managers/evented.rb', line 9
def start
EM.run {
trap_interruptions
begin
@consumers.each do |key, consumer|
RosettaQueue.logger.info("Running consumer #{key} in event machine...")
consumer.receive
end
rescue Exception => e
RosettaQueue.logger.error("Exception thrown: #{$!}\n" + e.backtrace.join("\n\t"))
end
}
end
|
#stop ⇒ Object
24
25
26
27
|
# File 'lib/rosetta_queue/consumer_managers/evented.rb', line 24
def stop
RosettaQueue.logger.info("Shutting down event machine...")
EM.stop
end
|