BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Ruote: A Workflow Engine Written in Ruby

Ruote: A Workflow Engine Written in Ruby

Bookmarks

Ruote is an open source workflow engine implemented in Ruby which was built by John Mettraux, Keneth Kalmer and Torsten Schoenebaum and other contributors. It is used by companies like ThoughtWorks and Rackspace to support mission critical integrations

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 ruote process definition describes the flow of work among participants.  While participants are generally registered at start time process definitions are ‘parsed’ at their launch time and transformed into an abstract syntax tree (a ‘tree’ for short) associated to the corresponding process instance. It can mainly read three flavours of process definitions : a Ruby DSL, a XML and plain trees (usually as JSON). A process definition contains one main process definition and may contain one or more sub-process definitions. For example:

 1 require 'ruote' # gem install 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

In ruote 2.1, multiple workers and engines are sharing a storage, and the participant list is persisted as well. ruote-couch is a storage implementation for ruote that uses Apache CouchDB.  ruote-amqp provides an AMQP participant/listener pair that allows you to distribute workitems out to AMQP consumers for processing, as well as launching processes over AMQP.

Ruote implements a complete series of workflow patterns:

  • sequence, parallel split, synchronization, exclusive choice, simple merge
  • multi choice, structured synchronizing merge, multi merge, structured discriminator
  • arbitrary cycles, implicit termination
  • multiple instance patterns
  • deferred choice, interleaved parallel routing, milestone
  • cancel task, cancel case
  • ...

Ruote was completely rewritten for the 2.0 and Ruote's core was rewritten for the 2.1 release. A couple of weeks ago, the team released v2.1.11. John also started to work on the volute project, a state machine implementation. John explained how he sees the difference between a "sequencial workflow" and a "state machine" in this post.

Rate this Article

Adoption
Style

BT