AnsweredAssumed Answered

Instant insert/update of variable inside JavaDelegate execution?

Question asked by nvulchev1 on Oct 16, 2015
Latest reply on Oct 21, 2015 by nvulchev1
We have use-case in which we perform some relatively long-running operations (think of up-to 30 sec to 1 minute) as part of a JavaDelegate.execute(). We have the requirement to report the progress of the execution of the JavaDelegate, which we currently do as updates of variables inside DelegateExecution. These variables are simultaneously read within a REST call of our backend via RuntimeService.getVariable(). Still we observe that the variables we set in the JavaDelegate implementation are committed to the database (and their up-to-date values are visible via RuntimeService.getVarialbe() call in our web request-handling thread) only after a successful finish of the execute() method.
What we want to achieve is direct insert/update of the variables in the database during the JavaDelegate.execute() method execution.   One workaround that we find to make this happen was to set the progress variables via RuntimeService.setVariable() call in a new Thread, which is not very clean. So, is there any recommended/more elegant way to achieve our goal?

Thanks,
Nikolay

Outcomes