cancel
Showing results for 
Search instead for 
Did you mean: 

RuntimeService API returning NULL

gurusri
Champ in-the-making
Champ in-the-making
1)For any workflow in Activiti that are running for a longer time, I would like to find the runtime details of the flow like what task has been completed so far and the status of the workflow.

For that I want to know the process instance ids of all the running flows. I tried using RuntimeService API but the RuntimeService is returning me a null upon querying from it. All the database tables that are provided are getting updated only at the end of the workflow.

The runtime tables in the database are not getting updated when a flow is running. It is updated only for user tasks and receive message tasks and not for service tasks.

Using RepositoryService API I am able to fetch only the process definition id and deployment id.

I tried the following code,

ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(_deploymentID).list().get(0);

ProcessInstanceQuery piq = runtimeService.createProcessInstanceQuery().processDefinitionId(processDefinition.getId());

List<ProcessInstance> pil = piq.list();
(it is returning an empty List)

Is there any possible ways that I could check the status of my workflow?

I am using Activiti 5.9.9

2)For any workflow, I also need to get the task level details, for example task start time, end time etc when the workflow reaches the end node and before it ends.
So I would like to hear from you on how to go about these use cases.
6 REPLIES 6

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

All the database tables that are provided are getting updated only at the end of the workflow.

The runtime tables in the database are not getting updated when a flow is running. It is updated only for user tasks and receive message tasks and not for service tasks.
Can be caused by not finished transaction. (Do you run process instance in one transaction?)
http://activiti.org/userguide/index.html#bpmnConcurrencyAndTransactions

Is there any possible ways that I could check the status of my workflow?
http://activiti.org/userguide/index.html#history

Regards
Martin

krishsan2k
Champ in-the-making
Champ in-the-making
Even I am facing the same problem when try to use the RuntimeService API's. It is not returning the process instance id's related to deployment id. Instead it returns an empty list

jbarrez
Star Contributor
Star Contributor
@krishsan2k: I'm not understanding your use case. Can you clarify?

msandoz
Champ in-the-making
Champ in-the-making
An example use case would be having an execution listener sending out a message to the UI to highlight the currently active node(s) and watch a flow execute live.

msandoz
Champ in-the-making
Champ in-the-making
i see now that you can get some of the info you need just by casting the event to an activiti activity event and then either forwarding the message or invoking the diagram generator.

jbarrez
Star Contributor
Star Contributor
@msandoz: indeed, that's correct.

Watching live is an interesting use case, because it could be that the process fails somewhere further down the path, but the event has already been sent…