cancel
Showing results for 
Search instead for 
Did you mean: 

boundary timer not working..

shiva_arunachal
Champ in-the-making
Champ in-the-making
HI,
I am facing issues getting boundary timer work. i deployed the "Helpdesk process" given in examples and deployed it through code using..
runtimeService.startProcessInstanceByKey("escalationExample", variableMap);

runtimeService.startProcessInstanceByKey("myProcess", variableMap);

and it worked fine.
Next i tried myProcess very similar to Helpdesk process the only difference is i replaced human tasks with service tasks. the service task has just some print statements and a
Thread.sleep(50000);//sleep for 50 seconds 
and boundary timer is set for 30 seconds as in Helpdesk process. But the boundary timer is never triggered.
I show the xml for the BPMN. Please assist.

I am not sure where i am going wrong. why is my boundary timer not getting triggered.???

<blockcode>
<process id="myProcess" name="My process" isExecutable="true">
    <startEvent id="startevent1" name="Start">
      <extensionElements>
        <activiti:formProperty id="element1" name="claimNumber" type="string" variable="claimNumber"></activiti:formProperty>
      </extensionElements>
    </startEvent>
   
   
   <sequenceFlow id="flow15" sourceRef="startevent1" targetRef="servicetask2"></sequenceFlow>
   
   
    <serviceTask id="servicetask2" name="EmailTask" activiti:class="com.accenture.services.ReverseStringsFieldInjectedEscalated"></serviceTask>
   
    <sequenceFlow id="flow14" sourceRef="servicetask2" targetRef="endevent1"></sequenceFlow>
  
    <endEvent id="endevent1" name="End"></endEvent>
  
    <boundaryEvent id="boundarytimer1" name="Timer" attachedToRef="servicetask2" cancelActivity="true">
      <timerEventDefinition>
        <timeDuration>PT30S</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
   
    <sequenceFlow id="flow10" sourceRef="boundarytimer1" targetRef="servicetask3"></sequenceFlow>
 
    <serviceTask id="servicetask3" name="Boundary timer task"  activiti:class="com.accenture.services.ReverseStringsFieldInjectedBoundary"></serviceTask>
  
    <sequenceFlow id="flow16" sourceRef="servicetask3" targetRef="endevent2"></sequenceFlow>
   
    <endEvent id="endevent2" name="End"></endEvent>
   
  </process>
</blockcode>
4 REPLIES 4

trademak
Star Contributor
Star Contributor
Boundary timer events on service tasks don't work in that way. Because Activiti will keep the transaction open for the full length of the Thread.sleep and the boundary timer event will not fire. Can you describe the use case for doing something like this?

Best regards,

shiva_arunachal
Champ in-the-making
Champ in-the-making
No use case as such. I am just learning Activiti and trying out its features like boundary timer.  From  your comment, i learnt something which is not mentioned anywhere in the userguide. What other restrictions apply to boundary timer ??? Does it apply only for human task??? Thanks.

shiva_arunachal
Champ in-the-making
Champ in-the-making
Is it a rule that both sides of the timer should be user tasks.???? I tried putting a service task when the boundary timer is triggered. but even that did not work..???
<blockcode>
<!–     <serviceTask id="handleEscalation" name="Boundary timer task"  activiti:class="services.ReverseStringsFieldInjectedBoundary"></serviceTask> –>
<userTask id="handleEscalation" name="Handle escalated issue"
  activiti:candidateGroups="management">
  <documentation>Escalation: issue was not fixed in time by first level
   support</documentation>
</userTask>
</blockcode>

If "handleEscalation" task is a service task, it is not triggered. but it get trigered if it is a userTask…. Strange…!!!! 😞

jbarrez
Star Contributor
Star Contributor
Timers work on user tasks, receives tasks, etc. All the steps that are a 'wait state'

Service tasks cannot have timers. If you need the functionality, you will need to implement it yourself in the execute() method using JDK threads/timers, etc.

Putting a service after a timer works. Could you show your process + java code to see what you are doing?

Also, no need to use multiple question or exclamation marks, they work well with only one of them.