At the end of the process, I do persisting all the names in database.
Lets say, at the point of time, I have collected “Peter”. And TimedOutException occurs. I am looking for a solution, how I can still retrieve the process variable “names”, so I can still persist “Peter”.
Looks like you’re executing the workflow in a synchronous manner. In the synchronous way of execution, to complete the entire process, the flow will take time and is directly proportional to the number of tasks and each task’s execution time. Enabling asynchronous execution of workflow gives savepoints between tasks which can avoid timeout errors and also data will be persisted at each savepoint/waiting state. So querying the variables would be easier even if an exception occurs at some step in the workflow.
I indeed have a synchronous workflow. Each collecting happens through a Camunda-Listener with REQUIRES_NEW. I can try to change it to NONE. After that, which method from org.camunda.bpm.engine.HistoryService could help me to retrieve the process variable? In fact, I only have the processInstanceId as parameter.
Just discussed the possible solution using ur advice with my lead-developer. Unfortunately, we dont have the HistoricService in production-mode. Another solution would be:
Are there alternatives to start ProcessInstance which do call-by-reference?
Thank you for the advice. I tried this and it does do the job, even though I still dont understand how come the ExecutionListener is being called even though a TimeoutException occured. I would have thought, that the workflow would just stop in case of TimeoutException, so that ExecutionListener or BoundaryEvent would not get called?
@hingiswiss Do you have any waiting states in the process?
ExecutionListener configured at the process level or at the EndEvent? For example, here you can see ExecutionListener configured for class TestClass at multiple places.