cancel
Showing results for 
Search instead for 
Did you mean: 

RuntimeService query for long running service, stuck in service task.

bardioc
Champ in-the-making
Champ in-the-making
Hello,

I've come across a special issue, where our application needs to know, whether a process for a certain business key has already been started. However, this process includes a heavy service thats at the beginning that blocks the process to read certain data from web services.

The process itself is started by a queue message and it is mandatory, that for a given business key only a single process instance is running. However, a query like

runtimeService.createProcessInstanceQuery() ….

does not find the running process until it has reached at least one transaction border (e.g. a manual task, an asynchronous task, or others) and because it may still be stuck in the long running service task, nothing is found.

Is there a way to determine, whether the activity engine is currently working running a process instance without the necessary commit into the database?

We handled this situation by setting async="true" for the long running service task, however, we actually would like to stay synchronous at that time to handle errors more conveniently in case the web service calls fail due to network issues.

Thank you for your help,

Best regards,

Heiko
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
You could use the event mechanism http://activiti.org/userguide/index.html#eventDispatcher to listen to entity create events for a process instance entity, to know when the process instance is created (but before it is started)