TimerEventDefinition behaviour.
The timer event definition publish a number of events.
Fired when the timer is started.
Object with properties. A subset:
content:
object with activity and timer informationtimeDuration
: the resolved time duration if anytimeDate
: the resolved expire date if anytimeCycle
: the resolved time cycle if anystartedAt
: timer started at dateexpireAt
: timer expires at daterepeat
: repeated timer number of repetitions, -1 means unbounded number of repetitions. NB! Only viable when used in non-interrupting BoundaryEvent
Fired when the timer has timed out or was cancelled.
Object with activity.timer
properties and some:
content:
object with activity and timer informationstoppedAt
: stopped at daterunningTime
: running for milliseconds
Default support for ISO8601 duration. Will set a timer (setTimeout
) for the duration and then complete when timed out. Invalid ISI8601 duration will throw and stop the execution.
Uses @0dep/piso
to parse duration and repetitions. Consequently ISO8601 intervals are supported.
Behaves the same as timeDuration
. Due date will timeout immediately. An invalid date, like 2023-02-29
, will throw and stop the execution.
Uses @0dep/piso
to parse date according to ISO8601.
Time cycles are parsed with @0dep/piso
that also handles ISO8601 intervals.
If another format is used, e.g. cron, you need to handle that by extending the behavior. There are several modules to handle time cycles and this project tries to keep the number of dependencies to a minimum.
The shortest timeout will be picked to start the timer.
If the parent event start message has an expireAt
date or timeout
positive integer property a timer will be started.
See how to format these messages here.
Another alternative is to override the parse function.
Timer event definition api.
Parse timer value into expire date.
Arguments:
timerType
: timer type string, one oftimeDuration
,timeCycle
, ortimeDate
value
: resolved expression timer string
Returns object:
expireAt
: expires at datedelay
: delay in millisecondsrepeat
: repeat number of times