Hi there,
we have a spring boot app that contains a camunda process engine. One of the endpoints performs a query against the current process and the history and returns the result. The result is a variable with a timestamp. If the variable is outdated, a new one is created and pushed to the current process. This throws an optimistic locking exception.
Some pseudo code:
(thread initiated by REST call) →
var variable = performQuery(…);
if (isOutdated(variable)) {
variable = createNewVariable(…);
pushToProcess(variable)
}
return variable;
Maybe camunda performs queries transactional as well as writing into the process. Then, the push action opens a new transaction in the transaction of the query.
One idea is to decouple the query from the current thread with a new thread.
What do you think?
TIA
Kibu