The CA Rule Engine inference engine invokes a Change Callback Method upon modifying a pre or post-condition field value, and when dynamically creating or deleting class instances visible to the client. However, a change callback method will not be invoked if the change is requested by the client, such as invoking the “updateObject” call of a stateful rule session, or as the result of client provided initialization callback.
Some situations where the Change Callbacks may be particularly useful:
For example, in a large corporation, the rules may need to modify the data for managers in the hierarchy of a given employee. For any given session, the rules only need to update the managers associated with the given employee. In this scenario, it would be impractical for a client to fetch post-condition values for all possible managers on the chance that the rules might have updated for those managers.
A Change Callback Method is the inverse of an Initialization Callback Method and may be used in conjunction with it.
Unlike an initialization callback method which is invoked at most only once, a change callback method may be invoked multiple times if the engine needs to update the same field multiple times. For value change callback, the new value provided may be the Java null value if the field is to be set to unknown by the engine and the client provided callback is expected to handle that special case.
Another difference between an initialization callback method and a change callback method is that new objects cannot be created and added to the session in a change callback method.
Depending on whether the field is a collection, or whether the operation is on an instance itself, the following three types of change callback methods may be defined.
| Copyright © 2009 CA. All rights reserved. | Email CA Technologies about this topic |