Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 49 lines (40 sloc) 1.11 KB
#!/usr/bin/env ruby
require 'rubygems'
require File.dirname(__FILE__) + '/lib/pelvis'
require File.dirname(__FILE__) + '/examples/actors/herault'
require File.dirname(__FILE__) + '/examples/actors/randomz'
require File.dirname(__FILE__) + '/examples/actors/chained'
require File.dirname(__FILE__) + '/examples/actors/inner'
require File.dirname(__FILE__) + '/examples/delegates/debugger'
def connect_herault
Pelvis.connect(:local, :identity => "herault", :advertise => false) do |agent|
agent.add_actor Herault
agent.on_advertised do
puts "herault is ready"
connect_foo
end
end
end
def connect_foo
Pelvis.connect(:local, :identity => "foo") do |agent|
agent.add_actor Randomz
agent.on_advertised do
puts "foo is ready"
connect_bar
end
end
end
def connect_bar
Pelvis.connect(:local, {:identity => "bar"}) do |agent|
agent.on_advertised do
puts "bar is ready"
agent.request(:all, "/do/random", {}, :identities => ["foo"], :delegate => Debugger.new)
end
end
end
if ENV["DEBUGGER"]
Pelvis.logger.level = Logger::DEBUG
end
EM.run do
connect_herault
end