Information Technology Reference
In-Depth Information
What Drools needs to work
To start with, all that Drools needs to work is a KIE session. In order for it to work with
rules, we need to include the DRL files in the KIE base that will be used, either through the
kmodule.xml configuration or through the programmatic API.
The following four methods are the most important calls that we need to know in the KIE
session to interact with the rules:
FactHandle insert(Object fact)
FactHandle update(FactHandle handle, Object fact)
void delete(FactHandle handle)
int fireAllRules()
The first three methods allow you to insert, update, and remove objects from the rule exe-
cution memory. The FactHandle class is a reference to the internal status of an object in
said memory. Finally, the fireAllRules method allows you to fire any rules that
matched any rule constraints for the inserted objects.
Every time we add, change, or remove objects from the internal memory of the KIE ses-
sion, evaluations of these objects are created that determine what rules should execute. The
fireAllRules method later invokes the following flow of execution:
Search WWH ::




Custom Search