[rules-users] [droolsflow] JPAKnowledgeService - how do you reload a Session with Processes?

Kris Verlaenen kris.verlaenen at cs.kuleuven.be
Thu Oct 22 21:19:30 EDT 2009


The getProcessInstances() method returns all process instances that are
currently loaded into the engine.  When using persistence, we
deliberately made that method to NOT fetch all active process instances
(as this could be thousands and that would impact performance).  So if
you use persistence, you will always get an empty list as the process
instances are not kept in memory but stored in the database.  But don't
worry, the engine will know when to reload process instances, you
shouldn't take care of that yourself.

Could you explain the use case you are trying to support in a little
more detail?  In general, I think you should be using a history log for
this, where you can query the active instances, the completed ones, what
happened, etc.

Kris

Quoting Bill Tarr <javatestcase at yahoo.com>:

> How do I FULLY reload my session with JPAKnowledgeService? 
> Specifically, shouldn't my session still know it's processes after
> reloading?
> 
> I'm using JPAKnowledgeService to persist my sessions and processes,
> after running, I have the following DB rows:
>    
>    SessionInfo - 1
>    ProcessInstanceInfo - 3 (1 ClaimFlow, and 2 subflow DocFlows)
> 
> I get a session properly with loadStatefulKnowledgeSession: 
> 
>    StatefulKnowledgeSession session =
> JPAKnowledgeService.loadStatefulKnowledgeSession( 1, knowledgeBase,
> null, env );
> 
> but this statement returns an empty collection:
> 
>    Collection<ProcessInstance> instanceCollection =
> session.getProcessInstances();
> 
> There is no key link between @Entity SessionInfo and
> ProcessInstanceInfo, so that result makes sense.... but shouldn't
> restoring the session restore the links to the active process within
> that session?
> 
> I can get the processes by id, but I'm not sure grabbing a subflow
> works in this example, I really want the session:
> 
>     ProcessInstance processClm = session.getProcessInstance(1);
> 
> Is there actually some other way to retrieve the processes from
> reloaded session?
> 
> As always, thanks for the help!
> 
> Bill
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 




Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the rules-users mailing list