Search code examples
workflowcamundabusiness-process-management

Camunda Run 2 tasks in parallel and cancel the 2nd task if the first completes


I am using Camunda as workflow engine. I define the registry process as follows: 1- User submit request. 2- Admin check request. If request needs editing, two tasks will raise, "Edit Request by User" and "Approve/Reject by Admin" (second task is used because user may not continue so that admin could finish the process).

enter image description here If one of the tasks is completed, the other task should be canceled and only one path of execution continued. How can I do that? Now if User complete "Edit Request by User" task, the "Approve/Reject by Admin" remains active (two paths of executions)

enter image description here Thanks a lot in advance


Solution

  • You have several options:

    1. use a conditional interrupting boundary event on the task you want to cancel. Let the other user task set a data, which the conditional event reacts to. When the data is set the task will be cancelled.
    2. Move the part of the process into an embedded sub process. Attach an interrupting boundary event to this whole embedded sub process scope. The event again react to a data you set when the one user task completes (or to another event you throw)
    3. Move the part of the process into an embedded sub process. Add an event-based sub process to the scope of the embedded sub process. The start event of the embedded sub process should be an interrupting event, e.g. a conditional event reacting to a data change.
    4. Least favorable: move the part of the process into an embedded sub process. Let the flow route into an terminating end event after the user task has been completed

    If all this sounds like gibberish to you, then you may want to check out: