processi

about processes and engines

Archive for the ‘rest’ Category

ruote on rails 2.0

update (2010/04/06) : this is an old post (2008), if you’re looking for ruote on rails, look at http://github.com/tosch/ruote-on-rails (rails3 branch is at http://github.com/tosch/ruote-on-rails/tree/rails3)

 

Two years ago I started writing Ruote, an open source workflow (incidentally BPM) engine written in Ruby. The immediate reaction was “how do I integrate that with Rails ? Please send me the code”. So I started writing an example Rails web application, it was initially nicknamed ‘densha’ and then renamed to ‘ruote-web’. There is a visible instance of this web application on a demo server.

But I’m not very good at web development and this was almost my first Ruby on Rails application. Time passed, I worked a lot on Ruote-Rest, a Ruby web application based on Rack (not Rails). Ruote-rest is meant to be consumed by HTTP clients that are not browsers, you could say it’s a RESTful webservice.

It is time for a second take at Ruote-Web. I started with a Rails plugin for easy integration of Ruote into a Rails application, it’s simply called ruote_plugin. It provides at first migration generation (workitem storage mainly, but also engine persistence via ActiveRecord instead of the filesystem if necessary) and then helper scripts for installing the engine and its dependencies under vendor/plugins/ or as gem.

The next step was building ruote-web2 on top of the ruote_plugin. Let’s note that the initial implementation of a “ruote plugin” was done by Tomaso Tosolini (who also wrote the rdbms based persistence for the process engine, Thanks a ton Tomaso !).

Ruote-web2 is way simpler than ruote-web, and it adheres to the resource structure laid by ruote-rest. It adds user and group resources though. For the user resource I didn’t look very far, I used the ultra-classic restful-authentication.

This will be an interesting packaging of Ruote for people of want to “just replace the Ruote logo and place theirs” to benefit immediately from a simple and robust open source workflow engine/suite (I’m quoting someone in the community for the “just replace the logo” thing).

Ruote process definitions can be expressed as XML, Ruby and now even JSON (or YAML if you push). I plan to integrate process definition tinkering into ruote-web2 (as I did in ruote-rest) and maybe more. That should mean edition of process definitions in the process portfolio and edition of definitions of processes in-flight (already implemented in ruote-rest).

The hardest part part of this implementation work is the QA, not only the classical QA but also the QA triggered by this goal : I’d like to have the same (RESTful) interface for ruote-rest and ruote-web2. The “connectedness” aspect deserves a big share of the design (and then QA) work.

Ruote-web2 is more perhaps “ruote-rest on Rails” than “ruote-web take 2”. There is a consequent amount of work left, but I’ll probably be done in three or four weeks.

It’s open source after all, so here are some links to the source of these tools :

http://github.com/jmettraux/ruote_plugin
http://github.com/jmettraux/ruote-web2

http://github.com/jmettraux/ruote

And finally to the mailing list :

http://groups.google.com/group/openwferu-users

Written by John Mettraux

September 29, 2008 at 1:38 pm

lunch with Keith Swenson

Last week, I had the privilege of having lunch with Keith Swenson. I have to admit I’m a fan of his “Go Flow” blog.

Keith Swenson is a fellow of the Workflow Management Coalition and he works for the R&D of Fujitsu Computers Systems. He has more than 15 years of experience in the workflow and business process management fields.

We talked about XPDL, federated workflows, RESTful BPM, WfXML-R and he gave me some explanations about the new Fujitsu process discovery service (I’d love to work on such a tool).

This meeting could have happened a bit earlier as we realized that our offices are just 4 blocks away from each other.

Keith gladly accepted to give a speech soon at a BPMinna meeting (Wakizaka-san, we have to talk about that).

This lunch was very instructive as well as friendly, I just forgot to ask for his business card, well, next time.

Written by John Mettraux

August 2, 2008 at 2:48 pm

Posted in bpm, rest, workflow, xpdl

twitter friends and followers

July 2009 update : this is a way better script.

A script for determining two Twitter sets : friends and followers, and the union of those two sets. It leverages the Twitter REST API.

I use it for my Twitter [social] graph gardening needs.

Prerequisite :

sudo gem install -y json_pure rufus-verbs

The script expects to find your Twitter username and password in the environment (TWUSER and TWPASS).

require ‘rubygems’

require ‘json’
require ‘rufus/verbs’

TW = “https://twitter.com”

USER = ENV[‘TWUSER’]
PASS = ENV[‘TWPASS’]
#
# fetches user and pass
# in the environment

def find (user, relation, page=1)

res = Rufus::Verbs.get(
“#{TW}/statuses/#{relation}/#{user}.json”,
:params => { :lite => true, :page => page },
:hba => [ USER, PASS ])

raise “error (#{res.code})\n#{res.body}” \
unless res.code.to_i == 200

f = JSON.parse(res.body)
f = f.collect { |f| f[‘screen_name’] }

f = f + find(user, relation, page+1) \
if f.size >= 100

f
end

# /!\ Clients may not make more than 30 requests
# per hour

friends = find USER, :friends
followers = find USER, :followers

(friends + followers).sort.uniq.each do |f|

flag = if (friends.include?(f) and
followers.include?(f))
“*”
elsif followers.include?(f)
“<" else "." end puts " #{flag} #{f}" end [/sourcecode] It will output a list that looks like :

 * dominieq
 . drniq
 * edmondedgar
 . elswa
 < ericsabaurin
 . github
 < gerloo
 < hickup
 * hotoande
 * htws

where . means “following him”, < “he follows me” and * “mutual follow”.

The script works well for my account, it should paginate friends/followers correctly for users with more than 100 persons in those sets. Twitter seems very sensitive about the request rate…

Written by John Mettraux

May 30, 2008 at 5:01 am

Posted in rest, ruby, social, twitter

restful bpm

Until now I mainly wrote about exposing a workflow/BPM engine as a set of resources. I’ll write a few line about the other side. I could have named this post “RESTful orchestration”, but BPM is shorter and is music related as well.

For orchestration vs choreography, the best quote, via Stefan Tilkov, might be :

In orchestration, there’s someone — the conductor — who tells everybody in the orchestra what to do and makes sure they all play in sync.

One might argue that the conductor is merely a metronome that cares about BPM and that every participant knows where he fits in the ensemble. Would ‘orchestration’ rather refer to the preparation work of the execution ? Arrangements ?

Let’s forget about big words and acronyms, there’s work to do and no time for taking part in an already old argument. Let’s get started with the resources and where they live. I’ll go with a content management example, it’s a just a few steps away (not hardcore ROA).

There is one staging server, one preview server and two production servers. Content is developed on the staging server, pushed on the preview server for approval and then passed to the production servers.

Read the rest of this entry »

Written by John Mettraux

May 27, 2008 at 9:07 am

Posted in bpm, openwferu, rest, ruby, workflow

ruote 0.9.18 released

OpenWFEru (Ruote) is an open source workflow and BPM engine written in Ruby. I just released version 0.9.18.

Why “Ruote” ? “OpenWFEru” is long to spell… The initial nickname was “Rufus”, but as I reused it for the subprojects not related to BPM, I needed another one. Tomaso suggested me “Ruote” and it sounded just right.

“Ruote” means “wheels” in italian, but it has migrated to english as well. Leopard’s dictionary says :

ruote |roōˈōtē|
noun
pasta that resembles small wheels with five spokes radiating from a hub.
ORIGIN Italian, literally ‘wheels’ .

And it’s OK to have a pasta as the nickname of a project that now allows to script spaghetti business processes thanks to the new step expression.

The complete release announcement as addressed to the users mailing list.

OK, back to work, I’d like to improve ruote-rest, I guess I’ll have to improve (finish) the example first before feeling restful.

homedemodownloadsourcequickstartissuesfeedback

Written by John Mettraux

May 22, 2008 at 5:33 am

restful workflow engine (on Sinatra)

 

2010 update : this is an old post, the latest incarnation of this rest[ful] workflow thing is ruote-kit, and yes, OpenWFEru got renamed into ruote a while ago.

 

It may seem as an exercise, writing something restful. In the first take, I used Ruby on Rails to wrap OpenWFEru with a RESTful interface.

In this second take, I considered the alternatives among the Ruby web frameworks and went for Sinatra by Blake Mizerany.

Ruote-rest is mainly the result of a collaboration with a company which is integrating OpenWFEru (ruote) among its .NET applications. Its software artifacts speak XML over HTTP with ruote.

Ruote-rest, as a “take two”, is also the refinement of the concepts explored in the take one.

So what’s this RESTful workflow/BPM engine ?

It’s named “ruote-rest” and it’s available from GitHub at http://github.com/jmettraux/ruote-rest.

It provides for now 3 resources, /processes, /participants and /workitems (and the special /expressions resource).

  • /processes – running [business] process instances
  • /participants – participants in the processes (out of the box there are two ‘worklist’ participants provided ‘alpha’ and ‘bravo’, but you can POST others and DELETE those)
  • /workitems – the workitems held by ‘worklist’ participants (for human consumption generally)

These resources are sufficient for

  • launching processes
  • fetching workitems, update their payload and let them resume in their business process
  • canceling part or all of a process
  • modifying a process on the fly
  • adding or removing participants to business processes

Ruote-rest currently provides two representations of its resources, an XML one and an HTML one. The XML representation is meant for automated consumption, the main case, while the HTML one is meant for learning / debugging.

The installation instructions are in the README.txt, and there is also a packaged release available.

— warning : boring technical post ahead —

Read the rest of this entry »

Written by John Mettraux

May 7, 2008 at 8:49 am

Posted in bpm, openwferu, rest, ruby, workflow

Pat is a subsversive restafarian

Sandy almost called the security to get Pat bounced out of Architecture & Process 2008. I’m joking, she just wondered what was Pat doing there.

If you consider the fact that “Architecture and Process” website is hosted at http://www.transformationandinnovation.com, then RESTful BPM is a nice fit for this event.

If you’re still not convinced, go and read Jason’s reaction and Pat’s reply.

Congrats to Pat Cappelaere for his success with RESTful WfXML.

I’m working on it as well (with my limited vision), after Kisha, I’ve moved on to Ruote-Rest.

Too many links.

Written by John Mettraux

April 26, 2008 at 11:17 am

Posted in bpm, geobpms, rest, workflow

rufus-verbs 0.3

verbsI just added cookie support and digest authentication to “rufus-verbs”, my small gem about the HTTP verbs.

I also created a mailing list for all the [current and upcoming] gems at http://rubyforge.org/projects/rufus

The documentation for this ‘rufus-verbs’ gem is available at http://rufus.rubyforge.org/rufus-verbs/

Written by John Mettraux

January 23, 2008 at 1:59 am

Posted in rest, ruby

gem : rufus-verbs

‘rufus-verbs’ is an extended HTTP client library (gem). It provides the four main HTTP “verbs” as Ruby methods : get, put, post and delete.

It wraps a certain number of techniques that make it a decent tool for manipulating web resources.

features

currently :

* follows redirections
* automatically adds _method={post|put} in the request parameters with the option :fake_put => true
* HTTPS aware (‘verify none’ by default)
* HTTP basic authentication
* doesn’t propagate auth credentials in case of redirection to different host
* advertises and uses gzip compression
* proxy-aware (HTTP_PROXY env var or :proxy option)
* conditional GET (via ConditionalEndPoint class)
* request body built via a block (post and put)

maybe later :

* retry on failure
* greediness (automatic parsing for content like JSON or YAML)
* http digest authentication
* cache awareness
* head, options

Read the rest of this entry »

Written by John Mettraux

January 18, 2008 at 1:25 am

Posted in rest, ruby

taskr – restful scheduler – by Matt Zukowski

Matt just announced he developed Taskr a RESTful cron / scheduler daemon written in Ruby.

A cron / scheduler managed via REST, that’s neat. PUT a task for execution in 5 days or every day at 6 am. There are facilities for the tasks to interact with other RESTful services.

taskr_screenshot

It’s based on Camping and on the OpenWFEru scheduler. For the Ruby on Rails aficionados, there is a Taskr Rails plugin.

I like the idea, it’s very focused, with a big potential. Congrats to Matt !

Written by John Mettraux

January 4, 2008 at 4:09 pm