JBoss Community

How to get active processes via ksession.getProcessInstances()

created by Ryan Peterson in jBPM - View the full discussion

Hey guys,

 

I'm using a single StatefulKnowledgeSession to manage my processes.  Each processInstance is mapped to a userId, which is stored in the params map as a process variable upon the start of the process: 

 

ksession.startProcess(processId, params)

 

Later I'd like to check if a specific userId exists in the workflow engine, which I was hoping to check all the active processInstances and search for the userId within their processVariables.

 

Unfortunately when I use ksession.getProcessInstances() I get 0 results.  Is there a way to do a "deep" search to find the active processes?  I am persisting the processes and StatefulKnowledgeSession, but I have not called .dispose() and am still in the same jvm instance (haven't restored the ksession from the database).

 

Is there a better way to find if a user is already in a workflow based on process variables?

 

Thanks for any help!

Reply to this message by going to Community

Start a new discussion in jBPM at Community