Class: Apollo::Agent::DomainerAgent

Inherits:
BaseAgent
  • Object
show all
Defined in:
lib/apollo_crawler/agent/domainer_agent.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseAgent

#run

Constructor Details

#initialize(amqp, opts = {}) ⇒ DomainerAgent

Returns a new instance of DomainerAgent.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/apollo_crawler/agent/domainer_agent.rb', line 33

def initialize(amqp, opts={})
	if(opts[:verbose])
		puts "Initializing crawler agent..."
	end

	# Declarations
	channel = amqp.create_channel
	declarations = Apollo::Agent.declare_entities(channel, opts)

	# Binding
	declarations[:queues]["domainer.queue"].bind(declarations[:exchanges]["domainer"]).subscribe do |delivery_info, , payload|
		puts "DomainerAgent: Received, metadata #{.inspect}" if opts[:verbose]

		msg = JSON.parse(payload)
	end
end

Instance Attribute Details

#declarationsObject

Returns the value of attribute declarations.



31
32
33
# File 'lib/apollo_crawler/agent/domainer_agent.rb', line 31

def declarations
  @declarations
end