Rule Execution Server API

Package com.ibm.rules.engine.ruleflow.runtime

Provides the entry point for running ruleflow engine.

See:
          Description

Interface Summary
FlowTask FlowTask defines a task embedding ruleflow control.
FunctionTask FunctionTask defines a Task embedding some statements to be executed as a function.
RuleflowEngine RuleflowEngine represents a ruleflow engine.
RuleflowEngineDefinition Use an RuleflowEngineDefinition instance to create RuleflowEngine instances and to access Task definitions.
RuleflowEngineInput RuleflowEngineInput is used to parameterize ruleflow execution.
RuleflowEngineOutput A RuleflowEngineOutput is produced when a RuleflowEngine is executed.
RuleflowObserver Use a RuleflowObserver instance to observe events specific to a RuleflowEngine instance.
RuleTask RuleTask defines a task embedding a RuleEngine.
RunningRuleflowEngine Represents a running RuleflowEngine
Task Use this interface to access the description of a task in the ruleflow.
 

Enum Summary
TaskKind The task kind.
 

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

Provides the entry point for running ruleflow engine.

Overview

You can use the rulflow API to create and execute your engine.

The main steps are:

  1. Load the engine
  2. Create the engine
  3. Set you data
  4. Execute the engine
  5. Retrieve the result

More explanations including code examples are provided in the sections below.

Load the engine

To load the engine

The following code shows how to do this:

   EngineLoader loader = new EngineLoader(file);
   EngineDefinition def = loader.load();

Create the engine

The following code shows how to create the engine:

  RuleflowEngine engine = (RuleflowEngine) def.createEngine();

Set your data

You need to provide your data to the engine thanks to a RuleflowEngineInput. The following example shows how to set them:

    RuleflowEngineInput ruleflowEngineInput = engine.createRuleflowEngineInput();
    ruleflowEngineInput.setParameter(name, value);
    ruleflowEngineInput.getWorkingMemory().add(yourObject);

The following code shows how to run the engine:

        RuleflowEngineOutput ruleflowEngineOutput = engine.execute(ruleflowEngineInput);

Retrieve the result

The following example shows how to retrieve the execution result

  int executedRuleInstanceCount = ruleflowEngineOutput.getExecutedRuleInstanceCount();
  int executedTasksCount = ruleflowEngineOutput.getExecutedTasksCount();
  ruleflowEngineInput.getData().get(yourParameterName);


Rule Execution Server API

© Copyright IBM Corp. 1987, 2013