1
votes

For my integration tests, I would like to specify the exact order in the execution paths of a parallel gateway are executed. I don't want to have the parallel paths executed concurrently but sequentially. Is there any way to achieve this with Camunda?

I have already tried to slow down one path by delaying the response of a mocked service call but since the mocked service call is not always used, this solution does not always work.

It would be enough to pause the execution of the one path until the execution of the other path has finished.

2

2 Answers

1
votes

This is not possible. In the camunda engine it is not guaranteed which sequence flow is taken on a parallel gateway.

Anyway in camunda engine there is not real concurrency, since each flow is sequentially executed (An process instance is single threaded). This means if the first flow is taken it is executed until an save point (wait state) is reached and the transaction is commited. This could be for example an User Task or any other Activity which is flagged with asyncBefore or asyncAfter.

After reaching this wait state the other sequence flow is executed.

For more information about transactions in camunda please read the documentation about Transactions in processes

0
votes

If all outgoing flows are marked as being executed asynchronously by the job executor, you could achieve this by enabling priority based job acquisition (jobExecutorAcquireByPriority property on the ProcessEngineConfiguration) and assign explicit priorities to those tasks.

This is documented in the user guide at https://docs.camunda.org/manual/7.8/user-guide/process-engine/the-job-executor/#configure-the-process-engine-for-job-priorities