Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 2 Channels and Events : Simple Events — Time to Live and Expiry Actions

Simple Events — Time to Live and Expiry Actions
Events have a time to live (TTL) setting. Events can’t be modified after they are initially asserted, but they can continue to trigger rules during their time to live.
Events Recovered From Cache or Persistence Store
When Cache object management is used, events with a sufficiently long time to live (TTL) setting are cached. Similarly, when Persistence object management is used, such events are persisted in the data store.
With Persistence and Cache OM types, the TTL period is re-evaluated when an event is recovered from the persistence database or reloaded from cache. For example, if the TTL is 60 minutes and the event is recovered 30 minutes after it is asserted, then its remaining TTL is 30 minutes.
Using TTL Options to Trigger Rules Correctly
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.
Example
Consider the following example:
Rule 1 has the condition: eventA.id == eventB.id.
Rule 2 has the condition: eventC.id != null.
At runtime, TIBCO BusinessEvents behaves as follows:
1.
TIBCO BusinessEvents receives eventA. Because there is no eventB in the Rete network, eventA doesn’t trigger any rules. TIBCO BusinessEvents consumes eventA.
2.
TIBCO BusinessEvents receives eventB, but eventA has been consumed — there is no eventA in the Rete network. So eventB does not trigger any rules. TIBCO BusinessEvents consumes eventB.
3.
TIBCO BusinessEvents receives eventC, which triggers Rule 2 because Rule 2 depends only on eventC.
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 for eventA to a time greater than the maximum period that can elapse between sending eventA and sending eventB.
If you don’t know the order in which eventA and eventB 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.
Event Expiration and Expiry Actions
After the time to live (TTL) period, the event expires and is deleted from the Rete network. Any expiry actions are taken.
With Persistence object management, the expired event is marked for deletion.
With Cache object management, events TTL is evaluated when the event is retrieved from the cache.
Expiry Actions
For each simple event definition, TIBCO BusinessEvents allows you to specify one or more actions to take when the event expires, using the TIBCO BusinessEvents rule language. For example, you can write an action that routes the simple event to a different destination, sends a message, or creates a new event. This action can be anything that is possible with the rule language.
An expiry action can be inherited from the event's parent.

Copyright © TIBCO Software Inc. All Rights Reserved