JBoss Community

Re: How to get active processes via ksession.getProcessInstances() (Jbpm 5.1.1)

created by Miljenko Norsic in jBPM - View the full discussion

Hi,

 

I spotted the exact same problem (please see http://community.jboss.org/message/628732, unrelated to your issue, but I have mentioned it as issue found while creating my processes).

It seems that Javadoc about method getProcessInstances() does not imply that in persistent scenario this method returns anything:

"Returns a collection of currently active process instances.  Note that only process instances that are currently loaded and active inside the engine will be returned.

When using persistence, it is likely not all running process instances will be loaded as their state will be stored persistently.  It is recommended not to use this method to collect information about the state of your process instances but to use a history log for that purpose."

 

So, I think you have to resort to the following:

1. create your own JPA query to fetch all running process instances for particular knowledge session, or

2. use history log

 

HTH

Miljenko

Reply to this message by going to Community

Start a new discussion in jBPM at Community