Method: Chef::IndexQueue::Consumer#run

Defined in:
lib/chef/index_queue/consumer.rb

#runObject Also known as: start



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/chef/index_queue/consumer.rb', line 41

def run
  Chef::Log.debug("Starting Index Queue Consumer")
  AmqpClient.instance.queue # triggers connection setup
  
  begin
    AmqpClient.instance.queue.subscribe(:ack => true, :timeout => false) do |message|
      call_action_for_message(message)
    end
  rescue Bunny::ConnectionError, Errno::ECONNRESET, Bunny::ServerDownError
    AmqpClient.instance.disconnected!
    Chef::Log.warn "Connection to rabbitmq lost. attempting to reconnect"
    sleep 1
    retry
  end
end