Samples > Rule Execution Server Integration > How to Use a Rule Session in Java SE

The sample shows you how to execute a rule session in Java SE. It simulates a batch process using a number of pre-trade check operations, with the goal of comparing the results of executing two different versions of a ruleset. The sample also demonstrates the use of Ant task management and the ruleset invalidation feature.

Key Features

The sample shows you how to execute a rule session in Java SE. It simulates a batch process using a number of pre-trade check operations, with the goal of comparing the results of executing two different versions of a ruleset. The sample also demonstrates the use of Ant task management and the ruleset invalidation feature.

Key features include:

Installing the Sample

To install the sample through the Samples Console:

  1. In the Samples Console locate the sample executionserver > j2serulesession.
  2. Ensure that the Samples Server is started. For information on how to start and stop the Samples Server, see Stopping and Restarting the Samples Server from the Samples Console.
  3. Execute the deploy.ruleapp target to register the RuleApp.

Running the Sample

The sample can only be run through the Samples Console.

Execute the run command to launch the Java program. This command executes the pre-trade check operations for all orders on the two rulesets.

To run the sample:

  1. Deploy a RuleApp that contains two ruleset archives, named 01012004rs.jar and 01012005rs.jar, using an Ant task.
  2. Generate an orders.xml file that contains 200 pre-trade orders.
  3. Apply the rules of the 01012004rs.jar ruleset archive on the orders file and generate a resultsRules2004.xml file.
  4. Apply the rules of the 01012005rs.jar ruleset archive on the orders file and generate a resultsRules2005.xml file.
  5. Compare the execution results of the two rulesets.

Source Files

The sample is located in <InstallDir>/executionserver/samples/j2serulesession.

Highlights

The sample demonstrates a standalone Java SE execution stack use case. The management stack is not deployed, therefore you will not be able to view the deployed RuleApps in the Rule Execution Server Console.

Rebuilding the Sample

The sample can be rebuilt through the Samples Console.

To rebuild the sample:

  1. In the Samples Console locate the sample executionserver > j2serulesession.
  2. Execute the build command to build the classes.

Related Concepts

J2SE and J2EE Applications
XML Binding
Rulesets and Ruleset Archives

Related Tasks

Changing the Console Persistence Type