Package ilog.rules.res.session.ruleset
See: Description
-
Interface Summary Interface Description IlrExecutionEvent IlrExecutionEvent
represents an execution event.IlrExecutionTrace IlrExecutionTrace
represents the detailed information about ruleset execution.IlrRuleAction Represents an action part of a rule, when executing with the decision engine.IlrRuleEvent IlrRuleEvent
represents an executed rule.IlrRuleflowElementInformation Information about a ruleflow element, whether a task or a rule.IlrRuleInformation IlrRuleInformation
represents information about a Rule.IlrTaskEvent IlrTaskEvent
represents an executed task.IlrTaskInformation IlrTaskInformation
represents information about a task. -
Class Summary Class Description IlrBusinessExecutionTrace IlrBusinessExecutionTrace
is a wrapper forIlrExecutionTrace
.
Package ilog.rules.res.session.ruleset Description
Provides the interfaces for execution traces.
Overview
An execution trace is a dynamic body of information that spans the process of a ruleset going in and coming out of the rule engine.
When a trace is enabled, an execution request is notified by means of a Boolean
value.
The IlrSessionRequest
class is initialized with a ruleset path, then the execution trace
is enabled using a session descriptor. You also use this descriptor to set and retrieve the filters
used for the session request.
After the ruleset is executed, the execution results are accessible in the form of an
execution response. The IlrSessionResponse
interface is used to access the properties and
the result of the execution trace.
The execution trace is gathered throughout the process of ruleset execution.
Trace filters
The following filters can be used to build the execution trace:
- time taken to complete the ruleset execution
- rules fired
- rules not fired
- tasks executed
- tasks not executed
- number of rules fired
- number of rules not fired
- number of tasks executed
- number of tasks not executed
- working memory as a collection
Code example
The following code example shows how to retrieve the standard and business trace information for an executed ruleset:
IlrSessionFactory sessionFactory = getFactory(); // Create a session request object IlrSessionRequest sessionRequest = sessionFactory.createRequest(); String rulesetPath = "/miniloanruleapp/miniloanrules"; if (!rulesetVersion.equalsIgnoreCase("Latest")) { rulesetPath = rulesetPath + "/" + rulesetVersion; } sessionRequest.setRulesetPath(IlrPath.parsePath(rulesetPath)); // Enable trace to retrieve info on executed rules sessionRequest.setTraceEnabled(true); // get all traces sessionRequest.getTraceFilter().setInfoAllFilters(true); // Set the input parameters for the execution of the rules Map<String,Object> inputParameters = sessionRequest.getInputParameters(); inputParameters.put("loan", loan); inputParameters.put("borrower", borrower); IlrStatelessSession session = sessionFactory.createStatelessSession(); // execute and get the response for this request IlrSessionResponse response = session.execute(sessionRequest); // get the execution Trace IlrExecutionTrace sessionTrace = response.getRulesetExecutionTrace(); // number of rules fired int rulesNumber = sessionTrace.getTotalRulesFired() ; // Get the Business version of execution trace IlrBusinessExecutionTrace execResult = new IlrBusinessExecutionTrace(response.getRulesetExecutionTrace()); // Get the list of rules fired (Business names) List<String> rulesFired = execResult.getRuleFiredBusinessNames(); // including output parameters state loan = (Loan) response.getOutputParameters().get("loan");