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_entities(channel, opts = {}) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/apollo_crawler/agent/exchanges.rb', line 57
def self.declare_entities(channel, opts={})
exchanges = self.declare_exchanges(channel, opts)
queues = self.declare_queues(channel, opts)
res = {
:exchanges => exchanges,
:queues => queues
}
return res
end
|
.declare_exchanges(channel, opts = {}) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/apollo_crawler/agent/exchanges.rb', line 40
def self.declare_exchanges(channel, opts={})
if(opts[:verbose])
puts "Declaring AMQP Exchanges"
end
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)
return exchanges
end
|
.declare_queues(channel, opts = {}) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/apollo_crawler/agent/exchanges.rb', line 23
def self.declare_queues(channel, opts={})
if(opts[:verbose])
puts "Declaring AMQP Queues"
end
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)
return queues
end
|