Postponing the processing of events by using when has occurred

The clause when <event> has occurred, after a delay of <calendar|absolute duration> instructs the agent to postpone the processing of the event.

You use postponed processing if an event depends on other events, if the order in which the events are processed is important, or if an action must happen after a certain duration. You can also test the presence or absence of events.

In a rule that uses the clause when <event> has occurred, after a delay of <calendar|absolute duration>, the event that occurred is the reference event. The rule is not triggered upon the arrival of this event, but it is postponed by a calendar or absolute duration. Each rule instance is applicable only once, when the condition that is expressed by the duration is satisfied.

Note: As time elapses between the time stamp and the system time, data can change during this elapsed time. In other words, the state of the entities might not be the same when the event is sent compared to the time when the event is processed.

In the following example, the normal delivery time is an attribute of the pizza order, and is defined as a duration in the business model definitions. The rule checks if the pizza order is not delivered after a delay that corresponds to the normal delivery time of the pizza order. If the order is not delivered, the order is late.

when a pizza order has occurred,
after a delay of the normal delivery time of this pizza order,
if
    the order status of 'the order' is not DELIVERED
then
    make it true that 'the order' is late;
The following rule postpones the processing of a purchase event. now is after a fixed calendar duration of one hour and 15 minutes after the purchase event.
when a purchase event has occurred 1 hour 15 minutes ago,
if the loyalty card amount of 'the customer' is more than 200
then ...