How to define timeCycle for 0 repetitions

Hi,

We have a process where a user task is created periodically. The timeCycle is passed on process-instance creation by a variable. Sometimes, however, we want to pass a timeCycle that results in NO repetition. We tried sending R0/ as start of the timeCycle but this results in continuous creation of tasks, even without taking the duration into account.

This is the process:

So:
R5/PT5M results in 6 tasks, created with 5 minute time interval, exactly as expected
R1/PT5M results in 2 tasks, created with 5 minute time interval, exactly as expected
R0/PT5M results in 1.000 tasks after only few seconds! Of course the result should be no repetition (so only 1 task created)

Is this a bug maybe?

Thanks!
Rogier

Hi - since this follows the ISO 8601 standard, I’m not sure it will recognize a 0 value for the repeat configuration. I think you have two options from a process standpoint to work around this.

  1. Have a decision gateway before the task to check if no repetition is needed and route to the same task but with no “non-interrupting timer” attached to the task
  2. In case of R0, set the timer to repeat after a very long time window, i.e. longer than the process should take to execute. Example would be R1/P1Y for repeating after 1 year, long after the instance is likely to have been completed

Hope this helps.

Hi,

Thanks a lot for looking into this. I also don’t know if the ISO 8601 standard supports R0. But, it is an option in camunda and it does something… Personally I think that either it should result in an error if it’s an unsupported timeCycle or do something similar to what I’m trying to achieve. But it should definitely NOT do what it does now, which is without any limit generate tasks, which would eventually result in system crash probably.

Since the n in Rn represents the number of repetitions, having n=0 most logically should result in no repetition in my option.

I tried to find a good workaround for it. 1. is, of course, possible and 2. is not really good because the process instance would exist all that time, which we don’t want. After this task the process can finish. But I’m sure I can find a good workaround. Of course, the post was more to verify the behaviour is as it should be or changed.

Rogier

What must you send the R0? PT5M would be the same as zero repetitions?

The Timer definition type is ‘Cycle’ (because most of the time we want repetitions). The cyclic timer needs a definition that starts with R<n>/. If you omit that you get this error:

org.camunda.bpm.engine.ProcessEngineException: ENGINE-09026 Exception while parsing cron expression ‘PT5M’: Illegal characters for this position: ‘PT5’