ruote

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

 1 require 'ruote'
 2 
 3 pdef = Ruote.process_definition :name => 'work' do
 4   cursor do
 5     concurrence do
 6       reviewer1
 7       reviewer2
 8     end
 9     editor
10     rewind :if => '${not_ok}' # back to the reviewers if editor not happy
11     publish # the document
12   end
13 end

the engine and some participants

 1 # engine
 2 
 3 require 'ruote/storage/fs_storage'
 4 
 5 engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::FsStorage.new('work')))
 6 
 7 # participants
 8 
 9 engine.register_participant 'reviewer.+' do |workitem|
10   puts "reviewing document #{workitem.fields['doc_url']}"
11   print "approve ?"
12   workitem.fields["#{workitem.participant_name}_reply"] = gets
13 end
14 
15 engine.register_participant 'editor' do |workitem|
16   puts "doc : #{workitem.fields['doc_url']}"
17   puts "reviewers approval :"
18   workitem.fields.entries.each do |k, v|
19     puts "#{k} : #{v}" if k.match(/\_reply$/)
20   end
21   print "should we publish ?"
22   workitem.fields['not_ok'] = (gets.strip == 'no')
23 end
24 
25 engine.register_participant 'publish' do |workitem|
26   PublicationService.post(workitem.fields['doc_url'])
27 end

launching some process instances

1 wfid0 = engine.launch(pdef, 'doc_url' => 'http://en.wikipedia.org/wiki/File:Bundesbrief.jpg')
2 wfid1 = engine.launch(pdef, 'doc_url' => 'http://en.wikipedia.org/wiki/File:Constitution_Pg1of4_AC.jpg')

later manipulations

 1 # querying
 2 
 3 [ wfid0, wfid1 ].each do |wfid|
 4   ps = engine.process(wfid)
 5   puts "errors for #{wfid} ? #{ps.errors.size > 0}"
 6 end
 7 
 8 # cancelling a process instance
 9 
10 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.rubyforge.org/irclogs/

See source for a list of the ruote related projects on github.