Making sure that the cached ruleset that is created by the loadUptodateRuleset method is used
Why does the rule invocation not reuse the ruleset cache? How to develop an application which warms up rulesets?
I have a web application that uses the loadUptodateRuleset method to warm up rulesets. Another Java EE component calls the rules for execution. But this application does not use the ruleset in the cache. Instead, another ruleset of the same version is parsed and used at run time.
Each engine that is used to execute a ruleset is linked to a given XOM class loader. You cannot reuse an engine that is linked to a different XOM class loader.
This means that the ruleset must be loaded with the same XOM class loader as the one used for execution.
When a web application is used to warm up rulesets, the ruleset is created with the XOM class loader of that web application. Then, if another application executes the same ruleset, the ruleset in the cache cannot be reused because it has a different XOM class loader.
To reuse the ruleset in the cache, the Java EE component or application that executes the rulesets must be the same as the one that preloads the ruleset or at least must have the same class loader in the context of the current thread.
You must set the maxIdle ruleset property to the appropriate value because the loadUptodateRuleset method only requests the XU to load the ruleset and does nothing else. In particular, it does not force the XU to keep the ruleset indefinitely in the cache. The ruleset might get unloaded before the next request.
To be sure that the ruleset is kept and loaded before any execution, you must both call the loadUptodateRuleset method, set the maxIdle property, and enable the property for XU ruleset usage monitoring.
- You can set the maxIdleTime in two ways. See the documentation at
>> IBM Operational Decision Manager 8.5.0>Operational Decision Manager V8.5>Decision Server Rules>Reference>Rule Execution Server reference > Predefined ruleset and RuleApp properties
For example, maxIdleTime =0
- To turn on the property for ruleset usage monitoring, use the WebSphere Application Server (WAS) administration console. See the documentation at
>> IBM Operational Decision Manager 8.5.0>Operational Decision Manager V8.5>Decision Server Rules>Managing business rule execution in Rule Execution Server>Configuring a Rule Execution Server instance>Changing the default behavior of the execution stack> Enabling ruleset monitoring
To illustrate how rulesets are warmed and called for parsing and execution, download the RulesetCacheSample-miniloan-server-webapp.zip web application and the miniloan rule project (RuleSample-miniloan.zip) that works with ODM V8.5 sample server.
- Import the miniloan-rule project, miniloan-xom project, and miniloan-ruleapp project into a clean Rule Designer workspace.
- Deploy the miniloan-ruleapp to Rule Execution Server if it does not contain the sample RuleApp. Make sure that the XOM is deployed, too.
The web application sample is a modified version of the application used in the Getting Started. The RulesetWarmup.java Java class and the two input.jsp and createruleset.jsp files have been added to demonstrate ruleset warming.
- Rename or back up the original application. You can find it in this directory:<ODM85>\gettingstarted\DecisionServer\start\miniloan-server-webapp
- Extract the modified miniloan-server-webapp from RulesetCacheSample-miniloan-server-webapp.zip to the <ODM85>\gettingstarted\DecisionServer\start\ directory. Replace the original one.
- Uninstall the existing miniloan-server application from the ODM sample server. Use the WAS administration console.
- Configure JAVA_HOME and ANT_HOME in check-env.cmd to suit your environment. It is recommended that you use the JDK and Ant tool that are provided with the ODM installation.
- Start the ODM sample server if it is not already running.
- Run install.cmd to package the miniloan-server-webapp as an EAR file and to install the EAR file to the sample server. At the end of the process, the following status message should be logged in the DOS console:
[exec] [wsadmin] GBRPS0017I: miniloan-server-webapp was successfully installed.
[exec] BUILD SUCCESSFUL
[exec] Total time: 20 seconds
[echo] Application ready.
- Access the sample at this URL: http://localhost:
- Submit the ruleset (/miniloanruleapp/miniloanrules) for ruleset warming.
The next page tells you that the ruleset cache is created.
The page is redirected to the main page, which shows the prepopulated values for miniloan validation.
- Make sure that the checkbox Use Rules is selected.
- Validate the loan application, which will call the rules.
More support for:
IBM Decision Server
Software version: 7.5, 8.0, 8.0.1, 8.5
Operating system(s): Platform Independent
Reference #: 1668133
Modified date: 01 April 2014