about processes and engines


openwfe-ruby is a library for interacting with OpenWFE, as its name implies, it’s written in Ruby. Yes, you can leverage OpenWFE from your Ruby application.

I wrote openwfe-ruby as I was spending some time in Costa Rica. I taught myself Ruby by writing a simple drill program for revising my spanish vocabulary and verbs. Then I wrote a first version of openwfe-ruby, based on the openwfe-python and openwfe-dotnet connectors.

Ruby is very elegant, as elegant as, well, I won’t tell.

I just wrote a listen / dispatch pair in Ruby for receiving / sending back workitems directly. An usage example :

require 'ocodec'

sl ='', 7010)
    # listens on port 7010 of the local interface

sl.listen do |workitem|

    workitem.attributes['ruby?'] = 'yes'
    puts "received workitem for flow #{workitem.attributes['__subject__']}"
        # let's perform some modifications on the workitem

    OpenWFE.dispatchWorkitem('', 7007, workitem)
        # and then, let's send it back to the engine (listening on port 7007)

As you can see, this piece of code, once running will listen for incoming OpenWFE workitems on port 7010. You have to set up a participant in etc/engine/participant-map.xml for it :

    <participant name="my-ruby-participant">

It’s important to set the ‘workitemCoder’ to ‘xmlCoder’, other workitem encoding formats are not supported by openwfe-ruby.

Then you can use the new participant from your process definition :

    <participant ref="alice" />
    <participant ref="my-ruby-participant" />
    <participant ref="bob" />

openwfe-ruby is still very young, this listen/dispatch pair, for example, doesn’t handle delivery problems. Some workitem attribute types encoding have not yet been implemented (XmlAttribute, Base64Attribute).
So if someone with Ruby experience and lots of passion is willing to enhance this connector, he (or she) is welcome.

download :

Written by John Mettraux

June 1, 2006 at 8:41 pm

Posted in dev, openwfe, oss, ruby, workflow

%d bloggers like this: