Hello,
I have some business code that calls a camunda process like in the following example.
ProcessInstanceWithVariables withVariablesInReturn = runtimeService.createProcessInstanceByKey("process")
.executeWithVariablesInReturn();
VariableMap variableMap = withVariablesInReturn.getVariables();
So far, none of the service tasks in the process has a checked async before/after. The initial idea was to start a process, then different tasks store some results within the variable map of the process and afterwards access these variables outside of the camunda process in the business code to do some other stuff. This works fine as long as the process execution is synchronous.
Now, as I found out, that it is best practice to activate âasync beforeâ at service tasks my approach doesnât work anymore, because the variables that are stored after the first savepoint (async) are not accessible anymore.
So my first question is, am I right that my initial idea of using âexecuteWithVariablesInReturnâ with an synchronous execution of the process is generally a bad design?
Second question is, what would be the best solution? Should I try to move the business code that is outside the camunda process and that accesses the process variables into the camunda process or into a new parent-process, so that I donât need âexecuteWithVariablesInReturnâ anymore?
Thanks very much for any advice!