[rules-users] Determining the active nodeinstance for a process

Garrett Conaty garrett at conaty.net
Fri Sep 4 11:58:34 EDT 2009


Outstanding.  Thanks for the help on this.

Was enjoyable to trace through the code, a nice event-driven state  
machine.

Question on JPAProcessInstanceManager.getProcessInstances.  I see that  
it returns an empty array, which I suppose makes sense otherwise it  
would load every process instance from the db?

What is the recommended strategy for keeping track of active processes  
that need to be loaded into a WorkingMemory for example on application  
startup?  An enhancement perhaps with different named queries through  
JPA or ?

It would seem that to perform some kind of reporting based on the  
active nodes, that using the WorkingMemoryDbLogger would be the best  
(and most inexpensive) choice.  Querying them dynamically has the  
potential to load them from the db on each query.

Thanks,
Garrett

On Sep 4, 2009, at 5:16 AM, Kris Verlaenen wrote:

> There are several ways of doing this.
>
> 1. Using the audit log
> You can log the execution events so they can be queried later.  The
> drools-bam module contains a WorkingMemoryDbLogger that logs these
> events to database, so you can easily query them.
>
> 2. Inspecting the process instance itself
> You can get all active node instances from the process instance itself
> by casting it to a WorkflowProcessInstance.  Note that this will only
> contain info about the currently active node instances, no history
> information, but it seems that's exactly what you're looking for.  The
> Eclipse plugin and gwt-console also use this approach to show the  
> active
> nodes in a process instance during execution.
>
> 3. Custom event listener
> If the above methods are insufficient, you can just implement your own
> listener and extract the info you need.
>
> Regarding reconnect, that simply reconnects the process instance to  
> the
> engine, nothing more.  The engine will then continue by sending the
> right triggers to that restored process instance, for example an
> incoming event, a work item that has been completed, a timer that has
> been triggered, etc.  So the engine will restore and reconnect a  
> process
> instance if a trigger for that process instance comes in but the  
> process
> instance is no longer in memory.
>
> Kris
>
> Quoting Garrett Conaty <garrett at conaty.net>:
>
>>
>>
>> I'm trying to determine 'where' a process is (not the
>> active/completed/
>> etc. state), but the wait state.
>>
>> One way of doing this (and tracing the process execution) would be
>> via
>> a RuleFlowEventListener; however is there a way to query a
>> ProcessInstance (or something?) for this information?
>>
>> Effectively I want to know which EventBasedNodeInstances are
>> triggered
>> for a process and waiting for a response.
>>
>> Use case is to show in a user interface what the process is waiting
>>
>> for (i.e. loan approval, timeout, some confirmation).
>>
>>
>> Furthermore, I am confused as to where a process resumes after being
>>
>> marshalled from db back into memory.  I can see that there is a
>> 'reconnect' method which gets called, but it looks like the
>> implementation of this calls the start Node again!?!
>>
>> Thanks,
>> Garrett
>
>
>
>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2419 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20090904/58609c53/attachment.bin 


More information about the rules-users mailing list