Time to Live and Expiry Actions
Events have a time to live (TTL) setting. Events cannot be modified after they are initially asserted, but they can continue to trigger rules during their time to live.
Global Variables are supported for Simple Event, TTL and Timer Event, Repeat every Values.
When Cache object management is used, events with a sufficiently long time to live (TTL) setting are cached.
With Cache OM types, the TTL period is re-evaluated when an event is reloaded from cache. For example, if the TTL is 60 minutes and the event is reloaded 30 minutes after it is asserted, then its remaining TTL is 30 minutes.
Set the event’s time to live so that it can trigger the rules you intend. If a rule correlates different events, you must ensure that those event instances are all in the Rete network concurrently. Time to live options are as follows:
- Zero (0): the event expires after the completion of the first RTC cycle. Do not set to 0 if you want to correlate the event with a future event or other future occurrences of this event, as explained below.
- One or higher (>0): the event expires after the specified time period has elapsed. The TTL timer starts at the end of the action block of the rule or preprocessor function in which the event is first asserted.
- A negative integer (<0): the event does not expire, and must be explicitly consumed.
Example
Consider the following example:
- A process sends eventA, eventB, and eventC.
- The TTL for all three simple events is 0.
- Rule 1 has the condition:
eventA.id == eventB.id
. - Rule 2 has the condition:
eventC.id != null
.
At runtime, TIBCO BusinessEvents behaves as follows:
- TIBCO BusinessEvents receives
eventA
. Because there is noeventB
in the Rete network,eventA
doesn’t trigger any rules. TIBCO BusinessEvents consumeseventA
. - TIBCO BusinessEvents receives
eventB
, buteventA
has been consumed — there is noeventA
in the Rete network. SoeventB
does not trigger any rules. TIBCO BusinessEvents consumeseventB
. - TIBCO BusinessEvents receives
eventC
, which triggers Rule 2 because Rule 2 depends only oneventC
.
To trigger Rule 1, you must configure the time to live for
eventA
and
eventB
to ensure that both events will be in the Rete network concurrently. You can trigger Rule 1 in these ways:
- If you know that
eventA
is sent before eventB, set the TTL foreventA
to a time greater than the maximum period that can elapse between sending eventA and sendingeventB
. - If you do not know the order in which
eventA
andeventB
are sent, set the TTL for both simple events to a time greater than the maximum time between the occurrence of the two simple events.