Samples > Rule-Based Programming > How to Process a Large Number of Objects

This sample shows how ILOG JRules can be adapted or configured to fit some cases where performance is crucial. The scenario executes a simple cashback computation process involving accounts and a very large number of credit card events per account.

Key Features

Key features include:

Importing this Sample

To import the manyobjects sample:

  1. Click File > Import.
  2. In the Import Wizard, select ILOG Rule Studio Samples and Tutorials and click Next.
  3. Select the samples > engine > manyobjects sample.
  4. Click Finish.
  5. If one or more files already exist in your workspace, a warning message is displayed indicating that the corresponding file(s) were not re-imported. Close the message window.
  6. The imported sample project files are displayed in the Rule Explorer.

Running this Sample

Make sure you are in the Rule perspective before running this sample.

To run the sample:

  1. Click Run > Open Run Dialog.
  2. Select the Java Application With Rules > manyobjects-application launch configuration.
  3. Click Run.
  4. Output is displayed in the Console view.

Highlights

The rule project manyobjects-rules contains the ruleset to be executed. An ilrmain function creates and inserts objects in the working memory and executes the ruleset. The rule execution output is displayed in the Rule Studio Console.

An engine.conf file is used to activate the useFinders option to assist with rule execution.

For each account to be processed:

This sample uses the flexibility of ILOG JRules to solve the problem. It provides ways to perform efficient pattern matching on many objects using ruleflow, finders, and collectors.

The rule project contains:

Rules are applied on a set of instances of several classes. This object model is a simple model made of few interfaces, implementation classes, and factories. It is referenced from the financialevent-xom Java project.

At runtime, the sample processes all the created accounts and logs information on the console. A large number of cash events are processed in a short time, and accounts are granted a REFUND computed with the rule-based rate. By default, 50,000 events are processed on 20 accounts (giving 1,000,000 possible combinations). The Java application provided in this sample is pre-configured to raise the maximum Java Virtual machine memory in order to successfully process this many combinations.

Related Concepts

Technical Rules

Related Tasks

Working with Technical Rules
Instrumenting Join Tests with Finders

Related Reference

collect

Related Samples and Tutorials

Import Samples and Tutorials Wizard