Module: Apollo::Agent

Defined in:
lib/apollo_crawler/agent/exchanges.rb,
lib/apollo_crawler/agent/base_agent.rb,
lib/apollo_crawler/agent/crawler_agent.rb,
lib/apollo_crawler/agent/fetcher_agent.rb,
lib/apollo_crawler/agent/domainer_agent.rb

Defined Under Namespace

Classes: BaseAgent, CrawlerAgent, DomainerAgent, FetcherAgent

Class Method Summary collapse

Class Method Details

.declare_exchanges(channel, opts = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/apollo_crawler/agent/exchanges.rb', line 23

def self.declare_exchanges(channel, opts={})
	if(opts[:verbose])
		puts "Declaring AMQP Exchanges"
	end
	
	# Exchanges
	exchanges = {}
	exchanges["crawler"] = channel.direct("crawler", :auto_delete => false, :durable => true)
	exchanges["domainer"] = channel.direct("domainer", :auto_delete => false, :durable => true)
	exchanges["fetcher"] = channel.direct("fetcher", :auto_delete => false, :durable => true)
	exchanges["planner.crawled"] = channel.direct("planner.crawled", :auto_delete => false, :durable => true)
	exchanges["planner.domained"] = channel.direct("planner.domained", :auto_delete => false, :durable => true)
	exchanges["planner.fetched"] = channel.direct("planner.fetched", :auto_delete => false, :durable => true)
	
	# Queues
	queues = {}
	queues["crawler.queue"] = channel.queue("crawler.queue", :auto_delete => false, :durable => true)
	queues["domainer.queue"] = channel.queue("domainer.queue", :auto_delete => false, :durable => true)
	queues["fetcher.queue"] = channel.queue("fetcher.queue", :auto_delete => false, :durable => true)
	queues["planner.crawled.queue"] = channel.queue("planner.crawled.queue", :auto_delete => false, :durable => true)
	queues["planner.domained.queue"] = channel.queue("planner.domained.queue", :auto_delete => false, :durable => true)
	queues["planner.fetched.queue"] = channel.queue("planner.fetched.queue", :auto_delete => false, :durable => true)

	# Compose res
	res = {
		:exchanges => exchanges,
		:queues => queues				
	}

	return res
end