◷ Reading Time: 2 minutes
Once a logic document is loaded (i.e. model is loaded), it creates an engine instance for execution. The FlexRule Runtime provides three types of creating an engine instance:
- Folder structure
- Deployment Package
- RuleSet (a.k.a Logic document package).
- Excel file (.xlsx)
Each Runtime Engine instance will be used to create the response to concurrent requests. It is tread-safe and can process requests in parallel.
Type of Execution
Running a logic might be using any of the below methods for execution:
- Forward chaining (i.e. procedural, directional/bidirectional graph, etc.)
- Backward chaining (i.e. inferencing)
In forward chaining, the sequence of execution is followed based on certain conditions and orders. This concept of execution is applicable on rules and other types of logic execution e.g. Workflow.
In this type of execution the sequence and order of steps are important and indication of how the execution engine will run the logic.
Another type of execution is backward chaining. In an inference engine, this method fires up rules against some facts and supports conflict resolution strategies (e.g. priority, FIFO, and LIFO) and agenda activation. (e.g. RETE algorithm). This method is supported on rules and decisions execution.
In this type of execution, the order is irrelevant, and dependencies will be indication of how the logic will be execution.
And you can have a logic document that has a hybrid approach, mixing both methods together.
Technically, a rule or logic is a container for ActiveElements which enforces a Signature – the combination of variables.
Signatures define four types of variables or parameters:
- Input variables
- Input/output (I/O) variables
- Local variables
- Output variables
All Input parameters must be set before execution. Local parameters are used only locally, they are a temporary value placeholders. The results that need to be seen or accessed from outside once the execution is done are stored in Output parameters.
Any logic document can define the parameters as a signature and the Declaration of logic describes [ISignatureVariableDescriptions] and [ISignatureTypeDescriptions] interfaces, which they expose the logic signature.
The diagram below illustrates the internal structure of a rules and logic with several parameters as different variable types.