It is possible to define rules dynamically completely at runtime ? Also change the ruleset at runtime.
For example,
at time = t_1 the ruleset is { R1, R2, R3 }
at time = t_2 the ruleset is { R1, R3, R4 }
.....
R1, R2 are rules that are defined at runtime.
Thanks.
Rule Definition − It consists of the Rule Name, the condition, and the Consequence. Drools keywords are rule, when, then, and end. In the above example, the rule names are “Hello World” and “GoodBye”. The when part is the condition in both the rules and the then part is the consequence.
Literal Restrictions using the operator '==' provide for faster execution as we can index using hashing to improve performance. One can bind variables to facts and their fields and then use them in subsequent field constraints. A bound variable is called a declaration.
Drools Rule Engine is a rule-based approach to implement an Expert system in the Drools software. The Rule engine provides Expert systems which are knowledge-based systems that help you to make decisions like what to do and how to do it. It gathers knowledge into a knowledge base that can be used for reasoning.
Yes, Drools is completely dynamic. You can add/remove/replaces rules at runtime. All the existing sessions are automatically updated in order to keep consistency. Check the documentation/javadoc:
http://www.jboss.org/drools/documentation
And here you can see some integration tests:
DynamicRulesTest.java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With