Skip to content

Instantly share code, notes, and snippets.

@p
Created June 11, 2010 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save p/434818 to your computer and use it in GitHub Desktop.
Save p/434818 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'ruote'
# preparing the engine
$engine = Ruote::Engine.new(
Ruote::Worker.new(
Ruote::HashStorage.new))
$child = Ruote.process_definition :name => 'child' do
participant :child
end
pdef = Ruote.process_definition :name => 'test' do
participant :parent
end
$engine.register_participant :parent do |wi|
puts 'parent'
$engine.launch($child)
$engine.launch($child)
$engine.launch($child)
end
$engine.register_participant :child do |wi|
# use sleep for wait_for difference demonstration, below
sleep 0.1
puts 'child'
# generate an exception
# comment this line to have the program terminate
bogus
end
# launching, creating a process instance
wfid = $engine.launch(pdef)
# this wait_for terminates program before children can run
#$engine.wait_for(wfid)
$engine.wait_for(:empty)
p 'end'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment