Notifying a XU on Java SE of a ruleset update
In a Java™ SE application, you can notify the execution unit (XU) that a ruleset is no longer valid because it has been updated.
About this task
To notify the execution unit (XU) of a ruleset update on Java SE, you create a management session from a Java SE rule session factory, you retrieve the canonical ruleset path, and you pass the IlrManagementSession.invalidate method on the instance of management session bean. This method takes a canonical ruleset path. To retrieve the canonical ruleset path, use the solveRulesetPath method. When a ruleset is invalidated, that ruleset is parsed at the next request. Therefore, this action might significantly affect performance.
In either of the following configurations,
you can have the XU notified of ruleset updates by connecting the
XU instances to a TCP/IP server:
- The Java SE XU does not run in the same Java virtual machine (JVM) as the Rule Execution Server console.
- The Java SE XU runs outside the application server cluster to which the Rule Execution Server is deployed.
Procedure
Example
Here is the entire code sample.
IlrJ2SESessionFactory sessionFactory = new IlrJ2SESessionFactory(new PrintWriter(System.out));
IlrManagementSession managementSession = sessionFactory.createManagementSession();
IlrPath rulesetPath = IlrPath.parsePath("/RuleApp/1.0/RuleSet/1.0");
managementSession.invalidate(rulesetPath);