End Process using a parallel gateway

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2013 06:36 AM
Hi, Im using a parallel gateway that open a task for each branch, like that:
_____________ userTask1——-END-EVENT_1
|
|
start—–parallel
|
|_____________userTask2———-userTask3—–etc—–END-EVENT_2
I want to end process if any branch reaches end, but dont work for me. Im going to the end-event completing userTask1, but dont end the process instance, it waits to complete the other branch and i dont want it.
Any solution? Thanks!!
Emmanuel.
_____________ userTask1——-END-EVENT_1
|
|
start—–parallel
|
|_____________userTask2———-userTask3—–etc—–END-EVENT_2
I want to end process if any branch reaches end, but dont work for me. Im going to the end-event completing userTask1, but dont end the process instance, it waits to complete the other branch and i dont want it.
Any solution? Thanks!!
Emmanuel.
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2013 08:54 AM
Hi Emanuel,
Could you use TerminateEndEvent?
Have a look on:
org.activiti.engine.test.bpmn.event.end.TerminateEndEventTest.testProcessTerminate()
in Activiti sources
Martin
Could you use TerminateEndEvent?
Have a look on:
org.activiti.engine.test.bpmn.event.end.TerminateEndEventTest.testProcessTerminate()
in Activiti sources
Martin

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2013 01:12 PM
Martin, thanks for reply. Im triying with terminate end event but not work for me. I have this code:
I want that when complete the task "userTaskEnd", my process end, at any time. I want to use this task like a flag.
<code>
<process id="myProcess">
<startEvent id="start" />
<sequenceFlow id="flow1" sourceRef="start" targetRef="forkInit" />
<parallelGateway id="forkInit"/>
<sequenceFlow id="flow1" sourceRef="forkInit" targetRef="serviceTask1"/>
<sequenceFlow id="alternativeFlow1" sourceRef="forkInit" targetRef="userTaskEnd" />
<serviceTask id="serviceTask_1" activiti:delegateExpression="${delegateExp}" >
<documentation> service task</documentation>
</serviceTask>
<userTask id="userTaskEnd">
<documentation> end the process instance </documentation>
</userTask>
<sequenceFlow id="alternativeFlow2" sourceRef="userTaskEnd" targetRef="end" />
<sequenceFlow id="flow2" sourceRef="serviceTask_1" targetRef="userTask_2" />
<userTask id="userTask_2" activiti:assignee="${user}" >
</userTask>
<sequenceFlow id="flow3" sourceRef="userTask_2" targetRef="userTask_3" />
<userTask id="userTask_3" activiti:assignee="${otherUser}" >
</userTask>
<sequenceFlow id="flow4" sourceRef="userTask_3" targetRef="exclusiveGw" />
<exclusiveGateway id="exclusiveGw"
name="exclusiveGw"/>
<sequenceFlow id="flow5" sourceRef="exclusiveGw" targetRef="userTask_4" >
<conditionExpression xsi:type="tFormalExpression" >
<![CDATA[${evaluation == 'OK'}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow6" sourceRef="exclusiveGw" targetRef="userTask_5" >
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${evaluation == 'NOT OK'}]]>
</conditionExpression>
</sequenceFlow>
<userTask id="userTask_5" activiti:assignee="${assigneeFP}">
</userTask>
<sequenceFlow id="flow7" sourceRef="userTask_5" targetRef="exclusiveGwNotOk" />
<exclusiveGateway id="exclusiveGwNotOk" name="Verify"/>
<sequenceFlow id="flow8" sourceRef="exclusiveGwNotOk" targetRef="userTask_2" >
<conditionExpression xsi:type="tFormalExpression" >
<![CDATA[${continue}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow9" sourceRef="exclusiveGwNotOk" targetRef="end" >
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${!continue}]]>
</conditionExpression>
</sequenceFlow>
<userTask id="userTask_4" activiti:assignee="${otherUser}" >
</userTask>
<sequenceFlow id="flow10" sourceRef="userTask_4" targetRef="newExclusiveGw" />
<exclusiveGateway id="newExclusiveGw"
name="newExclusive"/>
<sequenceFlow id="flow11" sourceRef="newExclusiveGw" targetRef="userTask_7" >
<conditionExpression xsi:type="tFormalExpression" >
<![CDATA[${newEvaluation}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow12" sourceRef="newExclusiveGw" targetRef="userTask_8" >
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[$!{newEvaluation}]]>
</conditionExpression>
</sequenceFlow>
<callActivity id="userTask_8" calledElement="otherProcess" >
<extensionElements>
<activiti:in source="actividad" target="tramite" />
<activiti:in source="otherUser" target="assignee" />
</extensionElements>
</callActivity>
<sequenceFlow id="flow13" sourceRef="userTask_8" targetRef="end" />
<userTask id="userTask_7" activiti:assignee="${newUser}">
</userTask>
<sequenceFlow id="flow14" sourceRef="userTask_7" targetRef="anotherExclusiveGw" />
<exclusiveGateway id="anotherExclusiveGw" name="Verifify new evaluation"/>
<sequenceFlow id="flow15" sourceRef="anotherExclusiveGw" targetRef="end" >
<conditionExpression xsi:type="tFormalExpression" >
<![CDATA[${boolean}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow16" sourceRef="anotherExclusiveGw" targetRef="userTask_4" >
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${!boolean}]]>
</conditionExpression>
</sequenceFlow>
<endEvent id="end" name="TerminateEndEvent">
<terminateEventDefinition></terminateEventDefinition>
</endEvent>
</process>
</code>
I want that when complete the task "userTaskEnd", my process end, at any time. I want to use this task like a flag.
<code>
<process id="myProcess">
<startEvent id="start" />
<sequenceFlow id="flow1" sourceRef="start" targetRef="forkInit" />
<parallelGateway id="forkInit"/>
<sequenceFlow id="flow1" sourceRef="forkInit" targetRef="serviceTask1"/>
<sequenceFlow id="alternativeFlow1" sourceRef="forkInit" targetRef="userTaskEnd" />
<serviceTask id="serviceTask_1" activiti:delegateExpression="${delegateExp}" >
<documentation> service task</documentation>
</serviceTask>
<userTask id="userTaskEnd">
<documentation> end the process instance </documentation>
</userTask>
<sequenceFlow id="alternativeFlow2" sourceRef="userTaskEnd" targetRef="end" />
<sequenceFlow id="flow2" sourceRef="serviceTask_1" targetRef="userTask_2" />
<userTask id="userTask_2" activiti:assignee="${user}" >
</userTask>
<sequenceFlow id="flow3" sourceRef="userTask_2" targetRef="userTask_3" />
<userTask id="userTask_3" activiti:assignee="${otherUser}" >
</userTask>
<sequenceFlow id="flow4" sourceRef="userTask_3" targetRef="exclusiveGw" />
<exclusiveGateway id="exclusiveGw"
name="exclusiveGw"/>
<sequenceFlow id="flow5" sourceRef="exclusiveGw" targetRef="userTask_4" >
<conditionExpression xsi:type="tFormalExpression" >
<![CDATA[${evaluation == 'OK'}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow6" sourceRef="exclusiveGw" targetRef="userTask_5" >
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${evaluation == 'NOT OK'}]]>
</conditionExpression>
</sequenceFlow>
<userTask id="userTask_5" activiti:assignee="${assigneeFP}">
</userTask>
<sequenceFlow id="flow7" sourceRef="userTask_5" targetRef="exclusiveGwNotOk" />
<exclusiveGateway id="exclusiveGwNotOk" name="Verify"/>
<sequenceFlow id="flow8" sourceRef="exclusiveGwNotOk" targetRef="userTask_2" >
<conditionExpression xsi:type="tFormalExpression" >
<![CDATA[${continue}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow9" sourceRef="exclusiveGwNotOk" targetRef="end" >
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${!continue}]]>
</conditionExpression>
</sequenceFlow>
<userTask id="userTask_4" activiti:assignee="${otherUser}" >
</userTask>
<sequenceFlow id="flow10" sourceRef="userTask_4" targetRef="newExclusiveGw" />
<exclusiveGateway id="newExclusiveGw"
name="newExclusive"/>
<sequenceFlow id="flow11" sourceRef="newExclusiveGw" targetRef="userTask_7" >
<conditionExpression xsi:type="tFormalExpression" >
<![CDATA[${newEvaluation}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow12" sourceRef="newExclusiveGw" targetRef="userTask_8" >
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[$!{newEvaluation}]]>
</conditionExpression>
</sequenceFlow>
<callActivity id="userTask_8" calledElement="otherProcess" >
<extensionElements>
<activiti:in source="actividad" target="tramite" />
<activiti:in source="otherUser" target="assignee" />
</extensionElements>
</callActivity>
<sequenceFlow id="flow13" sourceRef="userTask_8" targetRef="end" />
<userTask id="userTask_7" activiti:assignee="${newUser}">
</userTask>
<sequenceFlow id="flow14" sourceRef="userTask_7" targetRef="anotherExclusiveGw" />
<exclusiveGateway id="anotherExclusiveGw" name="Verifify new evaluation"/>
<sequenceFlow id="flow15" sourceRef="anotherExclusiveGw" targetRef="end" >
<conditionExpression xsi:type="tFormalExpression" >
<![CDATA[${boolean}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow16" sourceRef="anotherExclusiveGw" targetRef="userTask_4" >
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${!boolean}]]>
</conditionExpression>
</sequenceFlow>
<endEvent id="end" name="TerminateEndEvent">
<terminateEventDefinition></terminateEventDefinition>
</endEvent>
</process>
</code>
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2013 03:42 AM
The nature of a parallel gateway is what is it: it creates independent parallel paths. When using a joining p-gateway, it will wait for all paths to come in. Your usecase seems better suited to use signal or error-events.
You could have the path that needs to end the workflow (or end all parallel paths), end in a error throw event (or error end event). If you want to handle the "sudden end" of the process, you can add an event-subprocess with an error-start event (see userguide) so that you can do some cleanup or excalation. Alternatively, you can use a embedded sub-process and a boundary-event (with cancelActivity="true") instead of an event-subprocess.
You could have the path that needs to end the workflow (or end all parallel paths), end in a error throw event (or error end event). If you want to handle the "sudden end" of the process, you can add an event-subprocess with an error-start event (see userguide) so that you can do some cleanup or excalation. Alternatively, you can use a embedded sub-process and a boundary-event (with cancelActivity="true") instead of an event-subprocess.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2013 09:36 AM
Frederik, thanks for reply. Im triying but i dont know how implement this solution. I tried with that:
I have two branches from my parallel gateway. When complete the task "userTaskEnd", it goes to the endErrorEvent that i define but dont do nothing…my app freeze thinking and never ends the operation.
<code>
<error id="myError" errorCode="cancelationError"/>
<process id="myProcess">
<startEvent id="start" />
<sequenceFlow id="flow1" sourceRef="start" targetRef="forkInit" />
<parallelGateway id="forkInit"/>
<sequenceFlow id="flow1" sourceRef="forkInit" targetRef="serviceTask1"/>
<sequenceFlow id="alternativeFlow1" sourceRef="forkInit" targetRef="userTaskEnd" />
<serviceTask id="serviceTask_1" activiti:delegateExpression="${delegateExp}" >
<documentation> service task</documentation>
</serviceTask>
<userTask id="userTaskEnd">
<documentation> end the process instance </documentation>
</userTask>
<sequenceFlow id="alternativeFlow2" sourceRef="userTaskEnd" targetRef="endErrorEvent" />
<sequenceFlow id="flow2" sourceRef="serviceTask_1" targetRef="userTask_2" />
<userTask id="userTask_2" activiti:assignee="${user}" >
</userTask>
.
.
.
.
.
(etc)
<endEvent id="end"/>
<endEvent id="errorEndEvent">
<errorEventDefinition errorRef="myError">
</errorEventDefinition>
</endEvent>
</process>
</code>
I have two branches from my parallel gateway. When complete the task "userTaskEnd", it goes to the endErrorEvent that i define but dont do nothing…my app freeze thinking and never ends the operation.
<code>
<error id="myError" errorCode="cancelationError"/>
<process id="myProcess">
<startEvent id="start" />
<sequenceFlow id="flow1" sourceRef="start" targetRef="forkInit" />
<parallelGateway id="forkInit"/>
<sequenceFlow id="flow1" sourceRef="forkInit" targetRef="serviceTask1"/>
<sequenceFlow id="alternativeFlow1" sourceRef="forkInit" targetRef="userTaskEnd" />
<serviceTask id="serviceTask_1" activiti:delegateExpression="${delegateExp}" >
<documentation> service task</documentation>
</serviceTask>
<userTask id="userTaskEnd">
<documentation> end the process instance </documentation>
</userTask>
<sequenceFlow id="alternativeFlow2" sourceRef="userTaskEnd" targetRef="endErrorEvent" />
<sequenceFlow id="flow2" sourceRef="serviceTask_1" targetRef="userTask_2" />
<userTask id="userTask_2" activiti:assignee="${user}" >
</userTask>
.
.
.
.
.
(etc)
<endEvent id="end"/>
<endEvent id="errorEndEvent">
<errorEventDefinition errorRef="myError">
</errorEventDefinition>
</endEvent>
</process>
</code>
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2013 04:01 AM
I don't see a sub-process with a catching error-event around the gateway, service-tasks and usertask. Keep in mind that service-tasks, by default, are executed in the current thread. So the user-task won't be available to the outside (by using the taskService) infill both parallel paths are finished or have reached a wait-state. So this process will run the service-task, and the task will be available AFTER that. Because there is no catching error-event, the execution will be ended (none-end event-semantics). However, because the sub-execution is ended by the end-event, it never reaches the parallel join, making your process stuck on the join-gateway.
