3

Picture of the Problem

Here is my problem: All of the three sequence flows after the fork have to be checked separately and if they are negative I want to have a different process P2 being started. After P2 has been finished I want to go back into the process starting at P1 and I want to check all three sequence flows again after they have been forked.

Maybe an example helps to understand: We suppose C1 & C2 are positive, C3 is negative in the first iteration, so the system waits at the merging gateway for C3 while another iteration is started after the process P2. Now in the 2nd check C1 & C3 are positive and C2 is negative. Here is the problem: the exclusive gateway will join the sequence flows as if all checks were positive, even though C2 was negative in the 2nd iteration. I want it only to join them when ALL checks were positive in the SAME iteration.

xmojmr
  • 8,073
  • 5
  • 31
  • 54
DEls
  • 241
  • 3
  • 14

1 Answers1

2

Join the parallel branches with a merging gateway, then check the condition with only one exclusive gateway. This is easier to understand and to maintain, because it uses less gateways.

join branches


If C1, C2 and C3 should be terminated as soon as possible, you could extract the three branches into one sub process. The sub process throws a signal if one branch fails, and the surrounding process catches it.

sub process


Without sub processes you'll need an additional exclusive gateway and connections to the merging gateways for each activity in each branch. That adds up fast, if C1, C2 and C3 aren't simple activities but sequences, but could be okay for simple workflows.

The merging gateway after P2 prevents race conditions. For example if P2 finishes before C3 and therefore the second iteration would start before the first ends.

(Eventually you need an extra parallel gateway after each activity in a branch to split the paths.)

without sub process

Christian Strempfer
  • 7,291
  • 6
  • 50
  • 75
  • Thanks for your answer. It is indeed required that C1, C2 and C3 should be terminated asap, I wanted to try to avoid putting them into a subprocess. Do you think there is another possibility? – DEls Oct 20 '14 at 16:55
  • 1
    @DEls: Yes, it's possible without sub processes, but it's a big mess, because you would need an extra gateway for each activity. If C1, C2 and C2 aren't single activities but sequences that adds up fast. I wouldn't implement it that way in production code. I'll update my answer until tomorrow with an example (Ascii can't do that). – Christian Strempfer Oct 20 '14 at 17:05
  • Thanks for the good explanation. What Editor did you use to create the models? It looks nice and simple. – DEls Oct 21 '14 at 09:17
  • @DEls: I used [camunda Modeler Standard](http://camunda.org/bpmn/tool/). It's free. – Christian Strempfer Oct 21 '14 at 09:24