Timer intermediate event with timecycle

1,151 views
Skip to first unread message

annalen...@gmail.com

unread,
Mar 26, 2015, 6:09:04 AM3/26/15
to camunda-...@googlegroups.com
Hi,

I am currently trying to use a timer event with a timecycle to execute a script task multiple times. I use the following code to define the timer event.

<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent" name="IntermediateCatchEventName">
<bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
<bpmn2:timerEventDefinition id="_TimerEventDefinition">
<bpmn2:timeCycle xsi:type="bpmn2:tFormalExpression">R4/PT1S</bpmn2:timeCycle>
</bpmn2:timerEventDefinition>
</bpmn2:intermediateCatchEvent>

After the timer event there is the script task and after the script task an end event.

When deploying and executing this process the script task is only executed once. Since camunda claims to support this feature my question is, whether I defined the event correctly.


Thanks in advance and best regards
Annalena

Christian Lipphardt

unread,
Mar 26, 2015, 6:46:08 AM3/26/15
to camunda-...@googlegroups.com, annalen...@gmail.com
Hi Annalena,

The reason it is executed only once is the IntermediateCatchEvent fires once and then ends the process by executing the script and processing the end event, which ends the process.
What you wanna do it using a construct a loop and use a intermediate-catch-event coupled with a timeDuration like in [1]. Or you could use something like a multi-instance[2] construct coupled with the script task.

Cheers,
Christian

[1]: http://docs.camunda.org/latest/api-references/bpmn20/#events-timer-events-timer-intermediate-catching-event
[2]: http://docs.camunda.org/latest/api-references/bpmn20/#tasks-task-markers-multiple-instance

annalen...@gmail.com

unread,
Mar 26, 2015, 8:03:50 AM3/26/15
to camunda-...@googlegroups.com, annalen...@gmail.com
Hi Christian,

thanks for your quick response.
Your solutions sound good, but since I am trying to test the time cycle construct itself it would be no use for me to substitute it.

In what kind of process would a timecycle work? I have already tried to add a time event with duration between the script task and the end event, so the end event is not thrown before the time cycle is theoretically finished. But unfortunately this does not change anything.
Do you have any idea how to make the timecycle work?

Best regards
Annalena



Christian Lipphardt

unread,
Mar 26, 2015, 8:39:14 AM3/26/15
to camunda-...@googlegroups.com
Hi Annalena,

Usually you would use a timeCycle together with a
BoundaryIntermediateTimerCatchEvent. For example sending an email to a
service desk employee, resending it every 15 minutes til some task is
resolved.

We do not recommend the use of timeCycle in combination with the plain
IntermediateCatchTimerEvent.

Cheers,
Christian
signature.asc

Ingo Richtsmeier

unread,
Mar 26, 2015, 4:15:25 PM3/26/15
to camunda-...@googlegroups.com, annalen...@gmail.com
Hi Annalena,

I used a timecycle at a start event to start a new process instance every 5 minutes. It checks if there are new data (files/emails) in an inbox and triggers another process instance to handle these data.

Kind Regards, Ingo
Reply all
Reply to author
Forward
0 new messages