Start event with timer parameter

1,041 views
Skip to first unread message

michael...@globalorange.nl

unread,
Dec 3, 2014, 8:57:59 AM12/3/14
to camunda-...@googlegroups.com
I would like to start a process with a start timer with a cron string, passed in as a parameter. How would I do this?

What I am trying to do is for a parent process to start a bunch of subprocess where each will execute some number of times according to a cron string.

Ingo Richtsmeier

unread,
Dec 3, 2014, 9:38:38 AM12/3/14
to camunda-...@googlegroups.com, michael...@globalorange.nl
Hi Michael, have you tried it this way: http://docs.camunda.org/latest/api-references/bpmn20/#events-timer-events?

Regards, Ingo

Ingo Richtsmeier

unread,
Dec 3, 2014, 9:59:08 AM12/3/14
to camunda-...@googlegroups.com, michael...@globalorange.nl
And have a look into this class which handles the cron expression. https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/calendar/CycleBusinessCalendar.java

A tasklistener may help you to build your cron expression from a process variable dynamically.

Regards, Ingo

michael...@globalorange.nl

unread,
Dec 4, 2014, 4:33:02 AM12/4/14
to camunda-...@googlegroups.com, michael...@globalorange.nl
Hi:

Thanks for you responses.

I tried the following process:

start -> receive task with non-blocking timer set to R10/PT5S in 'timeCycle' node -> service task to print something to log.

I would have expected a message sent every 5 seconds to the service task delegate but it sends it continuously, as if in infinite loop (see below). Am I doing something wrong? Thanks

Dec 04, 2014 10:22:13 AM org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate execute
INFO: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Delegate called!!
Dec 04, 2014 10:22:13 AM org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate execute
INFO: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Delegate called!!
Dec 04, 2014 10:22:13 AM org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate execute
INFO: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Delegate called!!
Dec 04, 2014 10:22:13 AM org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate execute
INFO: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Delegate called!!
Dec 04, 2014 10:22:13 AM org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate execute
INFO: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Delegate called!!
Dec 04, 2014 10:22:13 AM org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate execute
INFO: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Delegate called!!
Dec 04, 2014 10:22:13 AM org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate execute
INFO: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Delegate called!!
Dec 04, 2014 10:22:13 AM org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate execute
INFO: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Delegate called!!
Dec 04, 2014 10:22:13 AM org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate execute
INFO: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Delegate called!!
Dec 04, 2014 10:22:13 AM org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate execute
INFO: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Delegate called!!
Dec 04, 2014 10:22:13 AM org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate execute
INFO: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Delegate called!!
Dec 04, 2014 10:22:13 AM org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate execute
INFO: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Delegate called!!
Dec 04, 2014 10:22:13 AM org.camunda.bpm.getstarted.loanapproval.ProcessRequestDelegate execute



Op woensdag 3 december 2014 15:59:08 UTC+1 schreef Ingo Richtsmeier:

michael...@globalorange.nl

unread,
Dec 4, 2014, 6:32:43 AM12/4/14
to camunda-...@googlegroups.com, michael...@globalorange.nl
It seems to work fine if the cycle is over 10 seconds:

R10/PT11S -> ok
R10/PT9S -> bad!



Op donderdag 4 december 2014 10:33:02 UTC+1 schreef michael...@globalorange.nl:

Ingo Richtsmeier

unread,
Dec 4, 2014, 8:56:01 AM12/4/14
to camunda-...@googlegroups.com, michael...@globalorange.nl
Hi Michael,

It would be nice to get a picture and the bpmn of your process definition.


The static block in Lines 36-40 gives you a very detailed output on the console. And you can markup the threads if you call

LogUtil.setThreadLogMode(ThreadLogMode.INDENT);

in the static block, too.

And here can you find more examples how to test timers in the process engines:


Hope this helps, Ingo
Reply all
Reply to author
Forward
0 new messages