5
votes

I am having trouble modeling one particular use case.

  • Task 1 and Task 2 are spawned in parallel.
  • Task 1 is repeated multiple times based on a condition.
  • Once the first Task 1 is completed, we must wait for Task 2 completion before continuing. Which means first iteration of Task 1 will wait (if Task 2 isn't yet complete), but subsequent iterations will continue since Task 2 is already completed.

Here is my try at modeling:

enter image description here

The issues I see with this model:

1- If Task 2 is completed before the first Task 1 is completed, the Event will be thrown, but not catched. And once Task 1 is complete, it will wait for event indefinitely.

2- On iterations 2+ of Task 1, it will wait indefinitely for the event as it is thrown only once.

Any help on how to model this would be appreciated, thanks !

2

2 Answers

5
votes

You should not use message event. Use conditional event. https://docs.camunda.org/manual/7.6/reference/bpmn20/events/conditional-events/

FYI: I am not familiar with camunda because I am using JBPM. However, for your case it is clear you have to use conditional event.

1
votes

First off, message events are not suitable for notifying within the same pool. Use signal events instead.

Without understanding the real semantics of task 1 & 2 it is difficult to give a good answer. I'd suggest to unroll the loop and have the first occurrence of task 1 concurrently with task 2, then synchronize with a join and then loop over remaining task 1s.