Try OpenEdge Now
skip to main content
BPM Events User's Guide
Administering and operating BPM Events : Event management : Cache management from the application

Cache management from the application

The rules of an applications should explicitly remove from the cache the events generated by this application (or for this application), once they are no longer useful. Once an event is removed from the cache, it is no longer accessible for future correlations. However, the event still remains in the database event queue, until it is flushed or archived. Consider two cases:
*Events of a type other than BP Server. Such events are notified either via one of the event channels, or internally, from a generate() or schedule() action statement. In such cases, a rule of the application decides when to discard them. When an event of this kind has triggered a rule and is not expected to be reused by future correlations, it is discarded by this rule. If it is expected to be reused for future correlations, then it is discarded by the rule that does this correlation. This is the case for the rule stock_back_to_normal in the tutorial: this rule discards not only the event that triggered it (Alarm::ProductInventoryNormal), but also the past event that correlates with the triggering event (ProductOutOfStock), since this event is no longer relevant, as shown in the following example:
rule stock_back_to_normal
activated by
event1 of Alarm::ProductInventoryNormal,
event2 of Alarm::ProductOutOfStock
if (event2.defaultingproduct = event1.backtonormalproduct)
then { discard (event1, event2); }
*Events generated by Business Process Server business processes (of type "BP Server"). These event types usually become inoperable once the process instance is completed. In that case, it is appropriate to delete from the cache (both memory and persistent image) all the events that relate to the completed process instance. Because these events are automatically indexed based on the process instance ID, they can be discarded at once, using the action statement: discardIndexEntry(). We then recommend that you write such a rule for each application (here identified as "myprocess"):
rule end_process
activated by evt of BP Server::PI_COMPLETED
if (evt.PROCESSTEMPLATENAME = "myprocess")
then { discardIndexEntry(evt.PROCESSINSTANCEID); }