Created
January 7, 2011 12:18
-
-
Save anonymous/769406 to your computer and use it in GitHub Desktop.
This file contains 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' | |
engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new)) | |
class MyParticipant | |
include Ruote::LocalParticipant | |
def consume(workitem) | |
p [ workitem.participant_name, :tags, workitem.tags ] | |
workitem.fields['qa_ok'] = true | |
reply_to_engine(workitem) | |
end | |
end | |
engine.register do | |
catchall MyParticipant | |
end | |
#engine.noisy = true | |
pdef = Ruote.define do | |
cursor do | |
sequence :tag => 'production-stage' do | |
production | |
concurrence :tag => 'qa_stage' do | |
qa1 | |
qa2 | |
end | |
end | |
rewind :unless => '${qa_ok}' | |
sequence :tag => 'delivery-stage' do | |
packaging | |
delivery | |
end | |
end | |
end | |
wfid = engine.launch(pdef) | |
engine.wait_for(wfid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment