Parallel SubProcess and Boundaryevents

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2015 03:42 PM
I am new to activiti and trying to create a parallel subprocess with a timeout and an error boundary event. I have three problems which I can't seem to solve on my own:
1. despite setting isSequential="true" in the multiInstanceLoopCharacteristics element, the SubProcesses are executed sequentially.
2. the timeout boundary event is never triggered.
3. despite setting cancelActivity=true" in the boundaryElement element, the subprocess is not cancelled when an errorEvent is thrown. After all subprocesses have finished, I get the following exception:
My script looks as follows (should be importable in a unit-test):
Would be grateful if someone could point out the errors I made.
1. despite setting isSequential="true" in the multiInstanceLoopCharacteristics element, the SubProcesses are executed sequentially.
2. the timeout boundary event is never triggered.
3. despite setting cancelActivity=true" in the boundaryElement element, the subprocess is not cancelled when an errorEvent is thrown. After all subprocesses have finished, I get the following exception:
org.activiti.engine.impl.pvm.PvmException: already taking a transition at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:443)
My script looks as follows (should be importable in a unit-test):
<?xml version="1.0" encoding="UTF-8"?><definitions id="definitions" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" targetNamespace="Examples" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/2.0/20100501/BPMN20.xsd"> <process id="testProcess" name="Test process"> <startEvent id="start"/> <sequenceFlow sourceRef="start" targetRef="listTask"/> <scriptTask id="listTask" name="Create List" scriptFormat="groovy"> <script> out:println "Task 1: creating list" def list = [] list.add("item1") list.add("item2") execution.setVariable("list", list) </script> </scriptTask> <sequenceFlow sourceRef="listTask" targetRef="decisionSubprocess"/> <subProcess id="decisionSubprocess" name="Subprocess"> <multiInstanceLoopCharacteristics isSequential="false" activiti:collection="${list}" activiti:elementVariable="item"> </multiInstanceLoopCharacteristics> <startEvent id="decisionStart"/> <sequenceFlow sourceRef="decisionStart" targetRef="decisionTask"/> <scriptTask id="decisionTask" name="Decide" scriptFormat="groovy"> <script> sleep(3000) out:println "List " + execution.getVariable("item") execution.setVariable("accepted", 0) </script> </scriptTask> <sequenceFlow sourceRef="decisionTask" targetRef="notificationAccepted" /> <exclusiveGateway id="notificationAccepted"/> <sequenceFlow sourceRef="notificationAccepted" targetRef="changesRejectedEvent"> <conditionExpression> ${accepted == 0} </conditionExpression> </sequenceFlow> <endEvent id="changesRejectedEvent"> <errorEventDefinition errorRef="changesRejected"/> </endEvent> <sequenceFlow sourceRef="notificationAccepted" targetRef="decisionEnd"> <conditionExpression> ${accepted == 1} </conditionExpression> </sequenceFlow> <endEvent id="decisionEnd"/> </subProcess> <boundaryEvent id="timeoutEvent" attachedToRef="decisionSubprocess" cancelActivity="true"> <timerEventDefinition> <timeDuration>PT2S</timeDuration> </timerEventDefinition> </boundaryEvent> <boundaryEvent id="errorEvent" attachedToRef="decisionSubprocess" cancelActivity="true"> <errorEventDefinition errorRef="changesRejected"/> </boundaryEvent> <sequenceFlow sourceRef="timeoutEvent" targetRef="timeout"/> <scriptTask id="timeout" name="Post Timeout" scriptFormat="groovy"> <script> out:println "Timeout occurred." </script> </scriptTask> <sequenceFlow sourceRef="errorEvent" targetRef="error"/> <scriptTask id="error" name="Post Decline" scriptFormat="groovy"> <script> out:println "Some declined." </script> </scriptTask> <sequenceFlow sourceRef="error" targetRef="end"/> <sequenceFlow sourceRef="timeout" targetRef="end"/> <sequenceFlow sourceRef="decisionSubprocess" targetRef="normalEnd"/> <scriptTask id="normalEnd" name="Post Accepted" scriptFormat="groovy"> <script> out:println "All accepted." </script> </scriptTask> <sequenceFlow targetRef="end" sourceRef="normalEnd"/> <endEvent id="end"/> </process></definitions>
Would be grateful if someone could point out the errors I made.
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2015 03:54 PM
Hi,
Please provide a unit test showing this behaviour (it will be easier for all of us to investigate it)
http://forums.activiti.org/content/sticky-how-write-unit-test
Please provide a unit test showing this behaviour (it will be easier for all of us to investigate it)
http://forums.activiti.org/content/sticky-how-write-unit-test

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2015 04:04 PM
Sorry, not sure if there is an edit option in this forum, but I could not find one. I've created a visual represenation of the process using activiti designer for better understandability of what I am trying to achieve:
http://postimg.org/image/jgh5ysen5/
So I create a list in the first task, iterate over it using parallel subprocesses and each subprocess may either terminate correctly or throw an error event.
edit: thx Vasile, I have attached the zip (renamed to .txt).
http://postimg.org/image/jgh5ysen5/
So I create a list in the first task, iterate over it using parallel subprocesses and each subprocess may either terminate correctly or throw an error event.
edit: thx Vasile, I have attached the zip (renamed to .txt).
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2015 04:24 PM
ok, let's see what's happening..
