two thread with same key executes user task sequentially

125 Views Asked by At

startActivity → ServiceTask1 → ServiceTask2 → UserTask1 → UserTask2 → endActivity

ThreadA with key KEY proceeds via ST1 and ST2 and commits its state to DB as UserTask1. However, this thread gets detached from UI due to some reason and UI triggers another call.

ThreadB again with same KEY goes via ST1 and ST2, but what will happen when it tries to update its state as userTask1 again ? will it throw any exception ? if no, will it override the existing state of process instance ?

1

There are 1 best solutions below

0
On

Every start process instance call triggers a new process instance with a unique technical process instance id. It does not matter which business Key you provide. Two process instances with the same business key can exist (but this should be avoided).

If you want to continue after the user task has been created, you need to run a query and complete the task. Same if you want to make updates to the process data. To make updates to a running process instance by using the business key, you can use a message with business Key as correlation criteria.