Execution trace sample details

This sample demonstrates how to get a simplified execution trace. To run the sample, you use the Samples Console.

Running this sample

To run the sample:

  1. Open the Samples Console.
  2. In the Samples Commands tab, expand Samples Commands > Rule Execution Server > Execution trace.
  3. Double-click the execute command.

The command compiles the code. It first checks whether the ruleset is deployed to the Rule Execution Server database, and a ruleset parameter file is provided. Then, the command runs the ruleset to apply for a loan of 100000, asking for a full trace.

The full trace is saved as a file in the output directory. A simplified trace is also saved in a file in the output directory. The samples console shows the simplified trace.

To see a different trace, edit the application/data/paramsde.xml file to change the amount to 500000. Save the file, and run the execute command again.

You see in the output that the amount is different and that different rules are fired.

To adapt this sample to your application

  1. Modify the arguments that you pass to the deploy.ruleapp command, by defining them in the build.xml file. These arguments include the project import path, the server list file, and the configuration to be built and deployed.
  2. Modify the application/data/paramsde.xml file that specifies the input parameters in the XML format.

Rebuilding this sample

To rebuild this sample:
  1. Open the Samples Console.
  2. In the Samples Commands tab, expand Samples Commands > Rule Execution Server > Execution trace.
  3. Double-click the clean command. The command compiles the code and does the following tasks:
    • Removes the RuleApp, the trace-xom resource, and the library link on Rule Execution Server.
    • Removes the classes and the output directories.

Source files

You can find this sample in <InstallDir>/executionserver/samples/tracedisplay. The JavaClient.java file is the class that calls the REST API and produces the simplified trace.

The class contains the following methods:
  • The constructor creates the HttpClient instance and sets the preemptive authentication. All further requests use the apiauth URL where the credentials are already given.
  • The execute method calls the REST API to run the ruleset and store the trace results in a file. It produces a trace that is less detailed than the one received in the response.
  • The displayFiles method shows the trace.
  • The clean method calls the REST API to delete the RuleApp and XOM from the Rule Execution Server database.

The JavaClient class API is called by the Ant commands in the build.xml file. The server-list.xml file contains the target Rule Execution Server information for RuleApp deployment.

You can view and modify the sample source files in Rule Designer:

  1. Open the Samples Console.
  2. In the Samples and Tutorials tab, expand Rule Execution Server > Samples.
  3. Under Execution trace, click Import projects.
  4. Switch to the Java™ perspective to view and modify the projects.