cancel
Showing results for 
Search instead for 
Did you mean: 

Repeating Timers Ignoring Intervals

ms1
Champ in-the-making
Champ in-the-making
Hello All,

I have a problem with a repeating timer. I want to send out a reminder email for a task at a specified interval : 3 total at 3 day intervals … so for the time cycle, I have R3/P3D.

What happens is that I get the first email in 3 days (as expected) and then the 2nd and 3rd emails are triggered on the 6th day. I would expect the 3rd email to trigger on the 9th day.

I did some experimenting and if I increase it to repeating 4 times, I see the same behavior where the 2nd timer triggers all remaining emails. (So, in this case, the 2nd, 3rd and 4th emails all trigger at the same time on the 6th day.)

Am I specifying this correctly? Is there some sort of configuration issue? Any help would be greatly appreciated.

Thanks
6 REPLIES 6

vasile_dirla
Star Contributor
Star Contributor
Hi,
This happens only in the combination with the email task or it also happens with other taks (scripts, service…)
please provide a zip (rename it as txt before uploading) with one of your experiments (a unit test to show this behaviour)

http://forums.activiti.org/content/sticky-how-write-unit-test

Thanks.

ms1
Champ in-the-making
Champ in-the-making
Hi Vasile,

I was able to try more timer scenarios and came to the conclusion that there is an issue with limited repeating intervals. An unlimited repeating interval works fine. I only tried this with a user task with a boundary timer and email task.

For example, if you use R3/P3D, the problem appears. If you use, R/P3D then there is no problem.

I didn't write a unit test, but I created a simple diagram which reproduces this issue.

Thanks,
Mark

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="TimerTest" name="TimerTest" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <userTask id="usertask1" name="User Task" activiti:assignee="ASSIGNEE"></userTask>
    <boundaryEvent id="boundarytimer1" name="Timer" attachedToRef="usertask1" cancelActivity="false">
      <timerEventDefinition>
        <timeCycle>R3/PT2M</timeCycle>
      </timerEventDefinition>
    </boundaryEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" sourceRef="usertask1" targetRef="endevent1"></sequenceFlow>
    <sequenceFlow id="flow2" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
    <serviceTask id="mailtask1" name="Mail Task" activiti:type="mail">
      <extensionElements>
        <activiti:field name="to">
          <activiti:string><![CDATA[youremail]]></activiti:string>
        </activiti:field>
        <activiti:field name="from">
          <activiti:string><![CDATA[youremail]]></activiti:string>
        </activiti:field>
        <activiti:field name="subject">
          <activiti:string><![CDATA[Timer Test]]></activiti:string>
        </activiti:field>
        <activiti:field name="charset">
          <activiti:string><![CDATA[ISO-8859-1]]></activiti:string>
        </activiti:field>
        <activiti:field name="html">
          <activiti:string><![CDATA[<HTML>
<BODY>
<DIV>
Test email.
</DIV>
</BODY>
</HTML>]]></activiti:string>
        </activiti:field>
      </extensionElements>
    </serviceTask>
    <sequenceFlow id="flow3" sourceRef="boundarytimer1" targetRef="mailtask1"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_TimerTest">
    <bpmndi:BPMNPlane bpmnElement="TimerTest" id="BPMNPlane_TimerTest">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="70.0" y="230.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55.0" width="105.0" x="180.0" y="220.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="boundarytimer1" id="BPMNShape_boundarytimer1">
        <omgdc:Bounds height="30.0" width="30.0" x="270.0" y="210.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="330.0" y="230.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="mailtask1" id="BPMNShape_mailtask1">
        <omgdc:Bounds height="55.0" width="105.0" x="310.0" y="140.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="285.0" y="247.0"></omgdi:waypoint>
        <omgdi:waypoint x="330.0" y="247.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="105.0" y="247.0"></omgdi:waypoint>
        <omgdi:waypoint x="180.0" y="247.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="285.0" y="210.0"></omgdi:waypoint>
        <omgdi:waypoint x="362.0" y="195.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

trademak
Star Contributor
Star Contributor
How are you testing this behaviour?
We have quite a bit of testing on timer logic in our unit tests, so I'm curious how you tested it.

Best regards,

ms1
Champ in-the-making
Champ in-the-making
Hi Tijs,

I created a simple diagram(xml below) and ran it with v5.17. I was able to start a process with time cycle set to R3/PT2M and reproduce this behavior. I then changed it to R/PT2M (deployed the new xml and started a new process) and it worked as expected.

Hope this helps,
Mark

<code>
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="TimerTest" name="TimerTest" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <userTask id="usertask1" name="User Task" activiti:assignee="ASSIGNEE"></userTask>
    <boundaryEvent id="boundarytimer1" name="Timer" attachedToRef="usertask1" cancelActivity="false">
      <timerEventDefinition>
        <timeCycle>R3/PT2M</timeCycle>
      </timerEventDefinition>
    </boundaryEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" sourceRef="usertask1" targetRef="endevent1"></sequenceFlow>
    <sequenceFlow id="flow2" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
    <serviceTask id="mailtask1" name="Mail Task" activiti:type="mail">
      <extensionElements>
        <activiti:field name="to">
          <activiti:string><![CDATA[youremail]]></activiti:string>
        </activiti:field>
        <activiti:field name="from">
          <activiti:string><![CDATA[youremail]]></activiti:string>
        </activiti:field>
        <activiti:field name="subject">
          <activiti:string><![CDATA[Timer Test]]></activiti:string>
        </activiti:field>
        <activiti:field name="charset">
          <activiti:string><![CDATA[ISO-8859-1]]></activiti:string>
        </activiti:field>
        <activiti:field name="html">
          <activiti:string><![CDATA[<HTML>
<BODY>
<DIV>
Test email.
</DIV>
</BODY>
</HTML>]]></activiti:string>
        </activiti:field>
      </extensionElements>
    </serviceTask>
    <sequenceFlow id="flow3" sourceRef="boundarytimer1" targetRef="mailtask1"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_TimerTest">
    <bpmndi:BPMNPlane bpmnElement="TimerTest" id="BPMNPlane_TimerTest">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="70.0" y="230.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55.0" width="105.0" x="180.0" y="220.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="boundarytimer1" id="BPMNShape_boundarytimer1">
        <omgdc:Bounds height="30.0" width="30.0" x="270.0" y="210.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="330.0" y="230.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="mailtask1" id="BPMNShape_mailtask1">
        <omgdc:Bounds height="55.0" width="105.0" x="310.0" y="140.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="285.0" y="247.0"></omgdi:waypoint>
        <omgdi:waypoint x="330.0" y="247.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="105.0" y="247.0"></omgdi:waypoint>
        <omgdi:waypoint x="180.0" y="247.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="285.0" y="210.0"></omgdi:waypoint>
        <omgdi:waypoint x="362.0" y="195.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
</code>

jbarrez
Star Contributor
Star Contributor
"I was able to start a process with time cycle set to R3/PT2M and reproduce this behavior"

So if Im understanding you correctly you are saying this fires at 2M, 4M only and not on 6M?

ms1
Champ in-the-making
Champ in-the-making
Yes. What I see is it will fire at 2M,  twice at 4M(so, 2 emails sent) and nothing at 6M. I also tried R4/PT2M and saw it firing multiple times at 4M also.

Thanks,
Mark
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.