There’s a question that comes often : “how do I know where I am in my running flow ?” to which I usually reply “you look at your worklist to see which participant has a workitem for that workflow instance”.
I agree, it may become awkward.
So I’ve just added a getFlowPosition(workflowInstanceId) method to the Control system of OpenWFE workflow engine.
The control system is an interface accessible via RMI or via REST which allows some basic engine administration, like stopping a workflow instance or cancelling it.
Until now, it only had one method for looking up expressions currently in the engine, which returned all the expressions composing all the workflow instances.
The method freshly added is named “getFlowPosition”. An example of its usage, let’s say you’ve got this process definition :
<concurrence> <sequence> <participant ref="a" /> <participant ref="b" /> </sequence> <participant ref="c" /> </concurrence>
the flow is at participants b and c and the instance id is 54321. A call to getFlowPosition(54321) will yield something like :
- 54321 flow 1.0 participant 0.0.0.1 - 54321 flow 1.0 participant 0.0.1
Unfortunately, for now, the participant name is not transmitted. For a flow where it’s determined dynamically (say it’s taken from a field, a function or a variable) that info might be very useful. A feature for later.
getFlowPosition() is part of the current (Tue Dec 26 16:50:33 JST 2006) snapshot release (via Maven2).