Rule attributes
Drools rules are data-driven. This means that the only way to activate a rule is by adding data to the engine that matches the conditions of that rule. However, there are multiple circumstances where we will want some rules with matching situations to be filtered out. One of this filtering mechanism is called rule attributes.
Rule attributes are extra features that we add to our rules to modify their behavior in a specific way. There are many rule attributes (of which, we'll explain the most used ones and some of their possible combinations) and each one modifies the way we filter rules execution in a different way, as follows:
rule "simple attribute example"
enabled false
when Customer()
then System.out.println("we have a customer");
end
If the enabled
attribute is set to false, the rule will be evaluated, however, it won't be executed. It is perhaps the simplest example of a rule attribute shown here to see that the rule attributes are...