cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel OR-join

arykov
Champ in-the-making
Champ in-the-making
What is the best way to implement OR-join of a previously split branches in activiti? Basically let the first branch to finish win.
I tried the following simplistic process to do this, but it never reaches finished state. I was trying it with 5.7


                         —(Receive Task1)—
(Start)—(+Gateway)-|                         |-(x Gateway)—(Finish)
                         —(Receive Task2)—
<process id="MyProcess" name="MyProcess">
    <documentation>Place documentation for the 'MyProcess' process here.</documentation>
    <startEvent id="startevent1" name="Start"></startEvent>
    <receiveTask id="receivetask1" name="Receive Task"></receiveTask>
    <receiveTask id="receivetask2" name="Receive Task"></receiveTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow8" name="" sourceRef="receivetask1" targetRef="exclusivegateway1"></sequenceFlow>
    <sequenceFlow id="flow9" name="" sourceRef="receivetask2" targetRef="exclusivegateway1"></sequenceFlow>
    <sequenceFlow id="flow10" name="" sourceRef="exclusivegateway1" targetRef="endevent1"></sequenceFlow>
    <parallelGateway id="parallelgateway1" name="Parallel Gateway"></parallelGateway>
    <sequenceFlow id="flow11" name="" sourceRef="startevent1" targetRef="parallelgateway1"></sequenceFlow>
    <sequenceFlow id="flow12" name="" sourceRef="parallelgateway1" targetRef="receivetask2"></sequenceFlow>
    <sequenceFlow id="flow13" name="" sourceRef="parallelgateway1" targetRef="receivetask1"></sequenceFlow>
  </process>
2 REPLIES 2

trademak
Star Contributor
Star Contributor
Hi,

In BPMN you would normally solve this using message events, but that's not yet supported with Activiti.
So for now I would solve this by using a sub process for the receive tasks. When one of the receive tasks is executed use a error end event to stop the sub process.
I know this is not very pretty, but it should work.

Best regards,

arykov
Champ in-the-making
Champ in-the-making
Thanks this works indeed.