AnsweredAssumed Answered

Loop with timer

Question asked by rachel on Aug 14, 2013
Latest reply on Aug 21, 2013 by trademak
Hi,

I have a problem with implementing a loop with timer. I want a logic as, first print "Please Wait", then start timer for 3 seconds, then goes to a gateway to check a parameter. If the parameter greater than something print some message then end. If not goes back to the print waiting then timer.
Below is what I have…Now it works fine if I have parameter greater than something going directly to the end. But when the parameter goes below something, it should goes back to "Please Wait" then goes to timer to wait for another 3 seconds then goes to "Please Wait" again. But now it keeps printing "Please Wait" seems that it never stops at the timer. Anyone can help?

Thanks!!


<?xml version="1.0" encoding="UTF-8"?>
-<definitions targetNamespace="http://www.activiti.org/test" expressionLanguage="http://www.w3.org/1999/XPath" typeLanguage="http://www.w3.org/2001/XMLSchema" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:activiti="http://activiti.org/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"> -<process isExecutable="true" name="My process" id="waitProcess"> -<scriptTask name="Print Message" id="scripttask1" activiti:autoStoreVariables="true" scriptFormat="groovy"> <script>out:println"Task Complete";</script> </scriptTask> <endEvent name="End" id="endevent1"/> <sequenceFlow name="to End" id="flow2" targetRef="endevent1" sourceRef="scripttask1"/> <startEvent name="Start" id="startevent1"/> -<scriptTask name="Print Waiting" id="scripttask2" activiti:autoStoreVariables="true" scriptFormat="groovy"> <script>out:println"Please Wait+${conditionParameter}";</script> </scriptTask> <sequenceFlow name="to Print Waiting" id="flow11" targetRef="scripttask2" sourceRef="startevent1"/> <exclusiveGateway name="Exclusive Gateway" id="exclusivegateway1"/> -<sequenceFlow name="to Print Message" id="flow12" targetRef="scripttask1" sourceRef="exclusivegateway1"> -<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${conditionParameter>50}]]>
</conditionExpression> </sequenceFlow> -<sequenceFlow name="to Print Waiting" id="flow14" targetRef="scripttask2" sourceRef="exclusivegateway1"> -<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${conditionParameter<=50}]]>
</conditionExpression> </sequenceFlow> <receiveTask name="Receive Task" id="receivetask1"/> -<boundaryEvent name="Timer" id="boundarytimer1" cancelActivity="true" attachedToRef="receivetask1"> <timerEventDefinition/> </boundaryEvent> <sequenceFlow name="to Receive Task" id="flow15" targetRef="receivetask1" sourceRef="scripttask2"/> <sequenceFlow name="to Exclusive Gateway" id="flow16" targetRef="exclusivegateway1" sourceRef="boundarytimer1"/> </process> -<bpmndi:BPMNDiagram id="BPMNDiagram_waitProcess"> -<bpmndi:BPMNPlane id="BPMNPlane_waitProcess" bpmnElement="waitProcess"> -<bpmndi:BPMNShape id="BPMNShape_scripttask1" bpmnElement="scripttask1"> <omgdc:Bounds y="286.0" x="540.0" width="105.0" height="55.0"/> </bpmndi:BPMNShape> -<bpmndi:BPMNShape id="BPMNShape_endevent1" bpmnElement="endevent1"> <omgdc:Bounds y="296.0" x="780.0" width="35.0" height="35.0"/> </bpmndi:BPMNShape> -<bpmndi:BPMNShape id="BPMNShape_startevent1" bpmnElement="startevent1"> <omgdc:Bounds y="296.0" x="20.0" width="35.0" height="35.0"/> </bpmndi:BPMNShape> -<bpmndi:BPMNShape id="BPMNShape_scripttask2" bpmnElement="scripttask2"> <omgdc:Bounds y="286.0" x="100.0" width="105.0" height="55.0"/> </bpmndi:BPMNShape> -<bpmndi:BPMNShape id="BPMNShape_boundarytimer1" bpmnElement="boundarytimer1"> <omgdc:Bounds y="296.0" x="340.0" width="30.0" height="30.0"/> </bpmndi:BPMNShape> -<bpmndi:BPMNShape id="BPMNShape_exclusivegateway1" bpmnElement="exclusivegateway1"> <omgdc:Bounds y="296.0" x="404.0" width="40.0" height="40.0"/> </bpmndi:BPMNShape> -<bpmndi:BPMNShape id="BPMNShape_receivetask1" bpmnElement="receivetask1"> <omgdc:Bounds y="286.0" x="250.0" width="105.0" height="55.0"/> </bpmndi:BPMNShape> -<bpmndi:BPMNEdge id="BPMNEdge_flow2" bpmnElement="flow2"> <omgdi:waypoint y="313.0" x="645.0"/> <omgdi:waypoint y="313.0" x="780.0"/> -<bpmndi:BPMNLabel> <omgdc:Bounds y="0.0" x="10.0" width="30.0" height="14.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> -<bpmndi:BPMNEdge id="BPMNEdge_flow11" bpmnElement="flow11"> <omgdi:waypoint y="313.0" x="55.0"/> <omgdi:waypoint y="313.0" x="100.0"/> -<bpmndi:BPMNLabel> <omgdc:Bounds y="20.0" x="-36.0" width="71.0" height="14.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> -<bpmndi:BPMNEdge id="BPMNEdge_flow12" bpmnElement="flow12"> <omgdi:waypoint y="316.0" x="444.0"/> <omgdi:waypoint y="313.0" x="540.0"/> -<bpmndi:BPMNLabel> <omgdc:Bounds y="2.0" x="-41.0" width="80.0" height="14.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> -<bpmndi:BPMNEdge id="BPMNEdge_flow14" bpmnElement="flow14"> <omgdi:waypoint y="296.0" x="424.0"/> <omgdi:waypoint y="222.0" x="423.0"/> <omgdi:waypoint y="222.0" x="279.0"/> <omgdi:waypoint y="222.0" x="154.0"/> <omgdi:waypoint y="286.0" x="152.0"/> -<bpmndi:BPMNLabel> <omgdc:Bounds y="4.0" x="-55.0" width="71.0" height="14.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> -<bpmndi:BPMNEdge id="BPMNEdge_flow15" bpmnElement="flow15"> <omgdi:waypoint y="313.0" x="205.0"/> <omgdi:waypoint y="313.0" x="250.0"/> -<bpmndi:BPMNLabel> <omgdc:Bounds y="4.0" x="-23.0" width="100.0" height="14.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> -<bpmndi:BPMNEdge id="BPMNEdge_flow16" bpmnElement="flow16"> <omgdi:waypoint y="311.0" x="370.0"/> <omgdi:waypoint y="316.0" x="404.0"/> -<bpmndi:BPMNLabel> <omgdc:Bounds y="0.0" x="10.0" width="100.0" height="42.0"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </definitions>

Outcomes