Module: QueueMap::Consumer::ThreadStrategy
- Defined in:
- lib/queue_map/consumer.rb
Instance Method Summary collapse
Instance Method Details
#start ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/queue_map/consumer.rb', line 113 def start @threads = [] count_workers.times do |c| @threads << (Thread.new do begin run_consumer rescue Exception => e logger.error %(#{e}\n#{e.backtrace.join("\n")}) end end) end end |
#stop(graceful = true) ⇒ Object
126 127 128 129 130 131 132 |
# File 'lib/queue_map/consumer.rb', line 126 def stop(graceful = true) if graceful @shutting_down = true else @threads.each { |t| t.kill } end end |