Skip to content

Instantly share code, notes, and snippets.

@irfn
Created March 15, 2010 07:30
Show Gist options
  • Save irfn/332602 to your computer and use it in GitHub Desktop.
Save irfn/332602 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'ruote'
require 'ruote/storage/fs_storage'
# preparing the engine
engine = Ruote::Engine.new(
Ruote::Worker.new(
Ruote::HashStorage.new))
# registering participants
#
# two simplistic "block participants"
#
# 'alpha' adds a piece of information to the workitem, while 'bravo'
# outputs that same part of that information
engine.register_participant :alpha do |workitem|
puts "alpha"
# raise "foo"
end
engine.register_participant :bravo do |workitem|
puts "bravo"
end
# defining a process
pdef = Ruote.process_definition :name => 'test' do
sequence do
participant :alpha
participant :bravo
end
end
# launching, creating a process instance
wfid = engine.launch(pdef)
engine.wait_for(wfid)
# blocks current thread until our process instance terminates
# => 'I received a message from Alice'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment