To implement a ruleset execution interceptor you must perform a number of steps on both the application side and on the Rule Execution Server side.
To implement a ruleset execution interceptor on the application side:
-
Write a class that implements the interface
IlrSessionRequestInterceptor.
| Note |
This class should have a public constructor with no parameter. The class can:-
Resolve a RuleApp path into a ruleset path by pointing to a ruleset inside this RuleApp. AND/OR
-
Change a ruleset path into another ruleset path by pointing to a ruleset inside the same RuleApp. AND/OR
-
Modify ruleset parameters.
|
The following code provides an example of such a class:
public class IlrTestInterceptor implements
IlrSessionRequestInterceptor {
public IlrTestInterceptor() {
public IlrSessionRequest transform(IlrSessionRequest
executionRequest, IlrRuleAppInformation ruleAppInfo)
throws IlrTransformException {
IlrSessionExecutionSettings execSettings =
executionRequest.getExecutionSettings();
IlrSessionDescriptor desc =
executionRequest.getSessionDescriptor();
String path = desc.getRulesetPath();
if (path.indexOf("ruleset") < 0) {
newPath = path + "/ruleset1";
newPath = path.replace('1','3');
IlrSessionRequest newRequest = null;
if (execSettings instanceof IlrSessionStatefulExecutionSettings)
IlrSessionStatefulExecutionSettings statefulExecSettings =
(IlrSessionStatefulExecutionSettings)execSettings;
newRequest = new IlrSessionRequest(newPath,
statefulExecSettings.getResetRuleflow());
newRequest = new IlrSessionRequest(newPath);
-
Package the class with your XOM classes.
-
Set the
enableInterceptor boolean of the request's descriptor to true.
To implement a ruleset execution interceptor on the Rule Execution Server side:
-
Set the RuleApp property
ruleapp.interceptor.classname to the fully qualified class name of your implementation, or to the IdentityInterceptor provided.
| Note |
Any ruleset execution performed without enableInterceptor set to true will not be impacted by the property.
|
Related Concepts
Related Tasks