On Thu, Sep 19, 2013 at 04:14:28PM -0700, ypz wrote:
>
> (...)
>
> What are other ways to look at/access a workitem of a running process ?
> Any examples?
Hello,
generally if you want to access the workitem of a running process, you use
the storage participant to make it available.
You don't tell if, by design, you want to make such workitems available. A
vanilla workflow uses participants as hooks into the plane of "real
participants", human and services who do the real work. If there are no such
hooks (or all those hooks are quick-lived participant who perform
immediately) then the flow probably doesn't lend itself to inspection.
Using the Dashboard you can inspect running processes, see "where" they are.
Workitems are usually waiting in expressions. Usually those wait points are
participant expressions, that dispatch, thanks to a participant
implementation, to a real participant. You are free to cancel existing
expressions (that's a kind of interaction) or pause them (that too). You can
reapply an expression (with a new workitem).
Cancelling a process is simply cancelling the root expression of a process.
Those expressions have an "applied_workitem" variable which contains a copy
of the workitem as it was when the expression was applied (instantied and
applied).
Some custom participant implementations leverage that "applied_workitem" and
use it to become some kind of storage participant like construct.
> So far, all my custom participants extends Ruote::Participant. I am not
> sure when should I use Ruote::StorageParticipant. Some general guidelines
> would help.
A guideline would be: if there is a human [decision] involved, use a storage
participant, else implement a custom participant.
The parallel thread with Denis shows another case. The storage participant is
used as a temporary storage for a workitem between a http call and its
callback. Denis could have implemented that with a custom participant too.
So the guideline is rather: if you can push the workitem to the real
participant, you use a custom participant. If the real participant pulls the
work from you, you use a storage participant.
But that's a guideline, not a law.
Look and play with the Dashboard methods to inspect processes and their
expressions.