Method: Messaging::ConsumerSupervisor#start

Defined in:
lib/messaging/consumer_supervisor.rb

#startObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/messaging/consumer_supervisor.rb', line 11

def start
  Concurrent.use_simple_logger
  Messaging.logger.info 'Consumers starting'
  @signal_to_stop = false
  @threads.clear
  @thread_pool = Concurrent::FixedThreadPool.new(consumers.size, auto_terminate: false)

  consumers.each do |consumer|
    @thread_pool.post do
      thread = Thread.current
      thread.abort_on_exception = true
      @threads << thread
      run_consumer(consumer)
    end
  end

  true
end