After each RTC, the data created in the agent is saved to the cache and removed from the Rete network. This is because the project uses Cache Only mode. Before the next RTC, therefore, you must reload any data needed by any rules that will be triggered in the RTC. This is generally done using the event preprocessor rule function, as it is the presence of event data that triggers most rules.
Loading data from cache into the Rete does not trigger rules At least not in the way it would if the data was newly arriving in an event. In conjunction with other data, however, the presence of the loaded data can trigger rules, in the usual way.
The Cluster.DataGrid.CacheLoadConceptByExtId() function loads any matching items from the cache into the Rete network. In this case, it loads any concept whose
ExtId matches the
AccountId in the incoming event. The loading is done before the event is asserted, so the Rete network will contain any matching Account concepts. The
BadCreateAccount rule then fires and as in the
Project Design Tutorial, to prevent creation of duplicate accounts.
You have modified the basic FraudDetection project to load instances from the cache into the Rete network using an event preprocessor. This enables the project code to check for existing instances first, when creating new ones.