# File lib/chef/index_queue/consumer.rb, line 58 def call_action_for_message(message) amqp_payload = Chef::JSONCompat.from_json(message[:payload], :create_additions => false, :max_nesting => false) action = amqp_payload["action"].to_sym app_payload = amqp_payload["payload"] assert_method_whitelisted(action) send(action, app_payload) end
# 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
Generated with the Darkfish Rdoc Generator 2.