Timer Event - Cron expression for "Date" definition


#1

Hi,

why is it not supported to use cron expressions for a single occurring timer (only as time cycle)?

I would love to tell the processengine to e.g. wait until Sunday 12:00 with a single expression.
Of course, I could compute a date in ISO 8601 format with some Javascript but using cron would be quite elegant.

Nevertheless I abuse the time cycle confiuration for enabling cron expression even though my model does not have a cycle.
The annoying part is, that I always get a warning, when deploying a BPM with such a configuration.

Cheers,
Chris


#2

Looks like this would be fairly easy to implement: https://github.com/camunda/camunda-bpm-platform/tree/master/engine/src/main/java/org/camunda/bpm/engine/impl/calendar. You can write a new business calendar that is basically a duplicate of duedate but has the extra logic to use the Cronexpression class similar to show it’s executed in the cycle calendar. Then you register the calendar when the engine is initialized in the custom calendar settings.

If you replace the due date calendar then you don’t need to change anything in the modeler. Otherwise if you create a additional calendar then you will need to modify the timer type directly in the bpmn xml.


#3

Thanks a lot for your input! I will give that a try.

I was just wondering if nobody else ever thought about the use of cron expressions in the “duedate” field.

After short research I found the BPMN 2.0 spec :

The return type of the attribute timeDate MUST conform to the ISO-8601 format for date and time representations.

So, it would not be conform to the BPMN 2.0 Standard using cron expressions. But also:

The return type of the attribute timeCycle MUST conform to the ISO-8601 format for recurring time interval representations.

Which means Camunda has extended the timer standard already - why not for duedate too?.