Try OpenEdge Now
skip to main content
BPM Events User's Guide
The rule language : Predefined rule actions : Discarding infopads and events : discardAllIndexEntry(): removing all events related to the same process and subprocesses
 
discardAllIndexEntry(): removing all events related to the same process and subprocesses
When a process P1 generates a subprocess P2, it may happen that the application rules require correlating events across P1 and P2. For example:
*P1 is a product ordering process.
*P2 is a product customization subprocess, that may be triggered by P1 depending on the content of the customer order.
In such a case, even if one of the two processes terminates before the other (for example, the customization subprocess P2), its events may be kept in cache, so that a rule can correlate with these events (that is, a rule calculating the invoice may require data from the customization process). In that case, you can discard the event as follows:
*Rules triggered by P2 events should not discard any P2 events at the end of P2 (that is, do not use discardIndexEntry).
*Rules associated with P1 should, at the end of P1, dispose of both P1 and P2 events. Do this in a single call, by using: discardAllIndexEntry().
The call discardAllIndexEntry(EVT1.PROCESSINSTANCEID) takes the ID of the parent (or root) process instance (P1 in the above example), and discards from the cache (and from its database image) all events of this process and its subprocess generated so far. Because the root process terminates after its subprocess(es), its completion event triggers the cache clean-up:
rule end_purchaseorder_process
activated by evt of BP Server::PI_COMPLETED{PROCESSTEMPLATENAME :
"PurchaseOrder"}
then { discardAllIndexEntry(evt.PROCESSINSTANCEID); }
In case the subprocess outlives the parent process, then the event completion of the subprocess must clean the cache from all events from both parent and subprocess. In order to do this, the subprocess must "remember" the ID of the root process. Each event generated by a subprocess contains, in addition to the ID of this subprocess (PROCESSINSTANCEID attribute), the ID of its root process (the "top" parent process). This "root process" ID is reported in the attribute named RPID of any event generated by a subprocess. The following rule triggers at the completion of any instance of the subprocess "OrderCustomization," and clean up events related to this instance and to its root process instance (of process "PurchaseOrder" in this example):
rule end_customization_process
activated by evt of BP Server::PI_COMPLETED{PROCESSTEMPLATENAME :
"OrderCustomization"}
then { discardAllIndexEntry(evt.RPID); }
Note: This applies only to BP Server events.