Module: Apollo::Helper::Amqp

Defined in:
lib/apollo_crawler/helper/amqp_helper.rb

Class Method Summary collapse

Class Method Details

.connect(conn, opts = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/apollo_crawler/helper/amqp_helper.rb', line 29

def self.connect(conn, opts={})
	res = nil

	if(opts[:verbose])
		puts "AMQP Connecting - #{conn.inspect}"
	end

	res = Bunny.new(:host => conn['host'], :user => conn['username'], :password => conn['password'], :vhost => conn['vhost'], :port => conn['port'])
	res.start

	sleep(0.001) until res
	if(opts[:verbose])
		puts "AMQP connected - #{res.inspect}"
	end

	return res
end