Method: Noah::Agent#broker

Defined in:
lib/noah/agent.rb

#broker(msg) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/noah/agent.rb', line 50

def broker(msg)
  e,m = msg.split("|")
  EM::Iterator.new(@@agents, @@agents.size).each do |agent, iter|
    #a = agent.to_s.gsub(/::/,'_').downcase
    x = agent.send(:new)
    begin
      #self.instance_variable_get("@#{a}").send(:notify, e, m, @@watchers)
      x.notify(e, m, @@watchers.clone)
      iter.next
    rescue Exception => e
      @logger.error("#{agent.to_s} invocation failed with #{e.message}")
    end
  end
end