Ruote is a workflow engine written in Ruby. Ruote is not a state machine library.
It could be described as an ‘operating system for business processes’.
A ruote engine may execute multiple process instances at a time. Processes are instantiated from process definitions written in a Ruby DSL or in XML (or directly as JSON). Process definitions describe the flow of work among participants. Participants stand for users, groups of users, services, legacy systems, etc.
a process definition
require 'ruote'
pdef = Ruote.define do
cursor do
concurrence do
reviewer1
reviewer2
end
editor
rewind :if => '${not_ok}'
# back to the reviewers
# if editor not happy
publish # the document
end
end
|
|
the engine and some participants
# engine
require 'ruote/storage/fs_storage'
engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::FsStorage.new('work')))
# participants
engine.register_participant 'reviewer.+' do |workitem|
puts "reviewing document #{workitem.fields['doc_url']}"
print "approve ?"
workitem.fields["#{workitem.participant_name}_reply"] = gets
end
engine.register_participant 'editor' do |workitem|
puts "doc : #{workitem.fields['doc_url']}"
puts "reviewers approval :"
workitem.fields.entries.each do |k, v|
puts "#{k} : #{v}" if k.match(/\_reply$/)
end
print "should we publish ?"
workitem.fields['not_ok'] = (gets.strip == 'no')
end
engine.register_participant 'publish' do |workitem|
PublicationService.post(workitem.fields['doc_url'])
end
launching some process instances
wfid0 = engine.launch(
pdef, 'doc_url' => 'http://en.wikipedia.org/wiki/File:Bundesbrief.jpg')
wfid1 = engine.launch(
pdef, 'doc_url' => 'http://en.wikipedia.org/wiki/File:Constitution_Pg1of4_AC.jpg')
later manipulations
# querying
[ wfid0, wfid1 ].each do |wfid|
ps = engine.process(wfid)
puts "errors for #{wfid} ? #{ps.errors.size > 0}"
end
# cancelling a process instance
engine.cancel_process(wfid1)
Ruote is available under the MIT open source license.
Ruote used to be named ‘openwfe-ruby’ then ‘openwferu’. The name is now ‘ruote’ (pronounce it ‘ru-o-te’ or ‘route’, as you wish).
For more, head to the documentation or to the quickstart or have a look at a few slides.
community
The mailing list is still the ‘openwferu’ one at http://groups.google.com/group/openwferu-users
The freenode.net channel is #ruote, feel free to stop by for a chat and a coffee. The channel archives are available at http://ruote-irclogs.s3.amazonaws.com/logs.html
See source for a list of the ruote related projects on github.
Here is a non-exhaustive list of organizations using ruote.