Table of Contents
This chapter describes how to work with timers in jBPM.
Upon events in the process, timers can be created. When a timer expires, an action can be executed or a transition can be taken.
The easiest way to specify a timer is by adding a timer element to the node.
<state name='catch crooks'> <timer name='reminder' duedate='3 business hours' repeat='10 business minutes' transition='time-out-transition' > <action class='the-remainder-action-class-name' /> </timer> <transition name='time-out-transition' to='...' /> </state>
A timer that is specified on a node, is not executed after the node is left. Both the transition and the action are optional. When a timer is executed, the following events occur in sequence :
timer
Every timer must have a unique name. If no name is specified in the
timer
element, the name of the node is taken as the name
of the timer.
The timer action can be any supported action element like e.g.
action
or script
.
Timers are created and cancelled by actions. The 2 action-elements are
create-timer
and cancel-timer
. Actually, the
timer element shown above is just a short notation for a create-timer action
on node-enter
and a cancel-timer action on
node-leave
.