Service race condition


I’m using the Camunda spring boot starter. I’m getting a race condition due to resolved tasks moving from TaskService to the HistoryService.


I want to get a list of tasks and their variables
taskService.createTaskQuery().taskAssignee(“someUser”).list().map { taskService.getVariables( }

so if a task is resolved/deleted after the list call and before it’s variables have been retrieved I will get a task now found error.

Is there a way for me to query the tasks and variables in together without resorting to using a native query?


We have been struggling with the same kinds of situations here, attempting to read or update Tasks which have been deleted. We’ve finally implemented a combination of retries and ignored errors to make things proceed.

One thing we did discover along the way though, is how easy it is through scripting to tap into the native query capabilities (and more), so we have no reluctance to go that route.

Yes I could do something like that alright but it is ugly code. it will be native query I guess.