[jBPM7 QuickTips] Timers

The timer is an event activity, which asynchronously triggers subsequent activities based on a predetermined agenda.  It can be used as:

  • a start event (i.e. start this process instance after 30 days from now), 
  • as an intermediate catching event (wait 5 minutes before starting the next task) ,
  • as a boundary catching event for tasks or subprocesses (if a user takes more than 2 days to finish a task, trigger a set of actions).

jBPM timers can be configured using Cron or ISO-8601 standard to define when the timer should be activated, how many times and a time interval for how long it should run.ISO-8601 standard was created with the objective of elaborating a crystal clear language to talk about dates and periods and avoid misinterpretation.  Check several tips on possible time definitions on the “ISO-8601 Time Standard”;

There are three possible options to configure the moment when a timer event will be activated:

Fire once after a duration: Should be defined with a period format. A period has the  format PnYnMnDTnHnMnS

Fire Multiple Times: Can be configured with ISO-8601 standard or Cron. If using ISO-8601, use a repeatable interval with period (repetition/period), formatted with Rn/PnYnMnDTnHnMnS. In Rn, n defines how many times the timer should be fired. If n is not set, the timer will trigger unlimited times. The period tells how long to wait between each activation. 

Fire at a specific date: Configured with a date time ISO-8601 pattern: <date>T<time>, where date is YYYY-MM-DD and time is HH:MM:SS. To trigger a timer for example in 12th April from 2020, at 6:40PM the following value should be used: 2020-04-12T18:40:00.

In all options, it is possible to use a dynamic value by using a process variable #{variableName}. Check the following process, with one intermediate catch timer event and one boundary timer event:

The customer just bought a new product.  Considering some time for the customer to try it out, after forty-eight hours, send the customer survey. An e-mail with a gentle reminder will be sent every five days until the task gets completed.

The image displays the timer settings of both timer events. Notice that the boundary timer has dashed lines: this means that this is not a canceling boundary event (the “Cancel Activity” checkbox setting is unchecked). If the boundary was configured with Cancel Activity setting, the user task would be canceled and the user would not have the chance to answer the survey. 

If there’s more information you missed or still have questions about timers, feel free to reach me and share your doubts.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s