Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v0.1.2
Fetching contributors…

Cannot retrieve contributors at this time

executable file 48 lines (40 sloc) 1.14 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 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
#!/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
Something went wrong with that request. Please try again.