Created
March 15, 2010 07:30
-
-
Save irfn/332602 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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