it’s barley a task manager
In the comments of the previous post, Karl asked me about ruote : “how to resume execution of the workflow from a web application ?”.
Though Karl’s questions was more about receivers, I took the time to explore a sample ruote application.
Barley is a [for fun] task manager. It takes its name from the barely repeatable processes, of course, it can’t compare with the excellent Thingamy work processor.
Barley is a Sinatra web application wrapping a ruote workflow engine. Ruote can run many process instances issued from different process definitions, but barley’s processes are all instantiated from a single process definition.
The cursor expression does most of the work. It runs in sequence a ‘trace’ participant and a ‘next’ participant. Then if the field ‘next’ is set in the workitem (most likely it has been chosen by the ‘current’ participant), the cursor is rewound and the task ends up on the ‘next’ participant’s desk.
PDEF = Ruote.process_definition :name => 'barley' do
cursor do
trace
participant '${f:next}'
rewind :if => '${f:next}'
end
end
If the ‘next’ field is empty, the cursor will be over, letting the process terminate.
Barley simply lets users push tasks around. There is no explicit “delegation”, “escalation” or whatever…
For the rest, look at the barley itself, it’s all in one single file, a workflow engine, two participants and the webservice, with the haml template at the bottom.
Torsten has deployed a demo instance at http://barley-plain.torstenschoenebaum.de/work. (he also has a version hooked to twitter auth).
You can install it and run it locally with :
curl http://github.com/jmettraux/ruote/raw/ruote2.1/examples/barley.rb -o barley.rb gem install sinatra haml json ruote ruby barley.rb
Then head to http://127.0.0.1:4567/
P.S.
to remove ruote and its dependencies from your gems :
gem uninstall ruote rufus-json rufus-cloche rufus-dollar rufus-lru rufus-mnemo rufus-scheduler rufus-treechecker
Another demo instance running as Passenger: http://barley-plain.torstenschoenebaum.de/work
Barley on Twitter: http://gist.github.com/289771
( Demo at http://barley.torstenschoenebaum.de/work )
Thanks for the fun!
Torsten
January 29, 2010 at 4:50 pm
[...] it’s barley a task manager « processi [...]
Ennuyer.net » Blog Archive » Rails Reading February 14 2010
February 14, 2010 at 6:38 pm