cancel
Showing results for 
Search instead for 
Did you mean: 

Locking an instance to update variables

franck102
Champ in-the-making
Champ in-the-making
Hi all,

We are building a complex product around the Activiti 5.15.1 engine and we occasionally need a background process to update the values of process variables in running processes (namely replacing a given URL stored in String variables with another one).
We don't control the process design (those are authored by our customers) so we need to do this through the Activiti APIs.

I am looking for a way to "pause" the process to perform the update, to avoid any race condition in particular with service tasks that may be using the variables. It seems like I would need to make sure that no job is currently active, then to prevent the engine from picking any new job or from performing any command while the update is under way… but looking into the APIs this seems far from straightforward.

Another approach I was thinking of would consist in creating a custom, exclusive update job on the fly and scheduling it - the idea being that the engine would pick it up and execute it.

Has anyone achieved something similar before? Any suggestions as to what the right design would be?

Thanks in advance!
Franck
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
Why can't the service task be waiting. I mean, when it enters the service task, it checks if the variable value is correct, and if not, wait (eg loops back to a receive task with a timer).