Package com.ibm.rules.engine.ruledef.runtime

Rule engine runtime API.

See: Description

  • Interface Summary 
    Interface Description
    Agenda
    Agenda provides information about the agenda during rule engine execution.
    AgendaController
    You use an AgendaController instance to control the Agenda during RuleEngine execution.
    AgendaController.Filter
    You use a Filter instance to filter Rule objects when they are posted into the Agenda.
    AgendaController.Sorter
    You use a Sorter instance to organize the list of ruleInstance objects contained in an Agenda
    AgendaObserver
    Use AgendaObserver to observe changes in an Agenda as it is used by an RuleEngine.
    CustomExceptionHandler
    CustomExceptionHandler is an interface to implement and to declare to provide a custom exception handling.
    ExceptionHandler Deprecated
    As of ODM 8.8.1, the interface CustomExceptionHandler should be used to write a custom exception handler
    Rule
    A Rule instance includes the name, package, description and properties of a rule.
    RuleAction
    RuleAction defines an action component in a Rule.
    RuleEngine
    RuleEngine represents a rule engine instance.
    RuleEngineDefinition
    Use RuleEngineDefinition to create RuleEngine instances and access Rule definitions.
    RuleEngineInput
    Use RuleEngineInput to parameterize RuleEngine execution.
    RuleEngineObserver
    Use RuleEngineObserve to observe events specific to a RuleEngine.
    RuleEngineOutput
    A RuleEngineOutput instance is produced when a RuleEngine is executed.
    RuleInstance
    An RuleInstance object is defined by the association between an RuleAction and the tuple that satisfies the condition part of a Rule.
    SteppingRuleEngine
    A SteppingRuleEngine is a rule engine that can execute rules one by one.
    SteppingRuleEngineObserver
    Use SteppingRuleEngineObserver to observe events created by a SteppingRuleEngine instance during rule execution.
  • Enum Summary 
    Enum Description
    Rule.Kind  

Package com.ibm.rules.engine.ruledef.runtime Description

Rule engine runtime API.

Overview

A rule engine definition is similar to a Classic Rule Engine ruleset. Using an engine definition you may:
  • access rules or tasks
  • create an executable rule engine

The rule engine uses a working memory and an agenda for containing and manipulating application objects. The working memory contains references to the application objects, and the agenda lists and orders the rule instances that are eligible to be executed.

Executing a rule engine

The following example shows you how to create and execute a rule engine.
EngineLoader loader = new EngineLoader(file);
RuleEngineDefinition engineDefinition = (RuleEngineDefinition)loader.load();
RuleEngine ruleEngine = engineDefinition.createEngine();

// working memory building
Collection<Object> wm = new ArrayList<Object>();
wm.add( myObject1 );
...
wm.add( myObjectN);
RuleEngineInput input = ruleEngine.createRuleEngineInput();
input.setWorkingMemory( wm );

// set potential parameters
input.setParameter( "myParameter", myValue );

// execution
try {
    RuleEngineOutput output = ruleEngine.execute( input );
    System.out.println ( "The number of rules executed is " + output.getExecutedRuleInstanceCount() );
  } catch ( Exception e ) {
   ...
  }

Rules

A rule in IBM Decision Server is represented as an Rule instance. Use Rule to obtain information about a particular rule. It is always attached to an RuleEngineDefinition object.

Monitoring the decision engine

Monitoring in the decision engine is divided in several observer interfaces. These observer interfaces extend Observer. To monitor an engine execution, implement the interfaces for the events you want to observe. For example, if you want to observe the events related to the engine start and stop, and the rule instance execution, write an observer class (MyObserver) implementing both EngineObserver and RuleEngineObserver. The observer is then passed to the rule engine:
RuleEngine engine = engineDefinition.createEngine();
MyObserver observer = new MyObserver();
engine.addObserver(observer);
EngineOutput output = engine.execute(engineInput);
Rule Designer API

© Copyright IBM Corp. 1987, 2017