Reputation: 1
I want to load different drl files into a kiebase, if the rules have no salience attribute attached to them, will the default execution order be aligned with the order in which they are specified in the kmodule? I mean, does Drools, behind the scene, just create one large drl file automatically from the multiple drl files, then execute. My understanding is if the rules in a rule file have no salience, then as they are written they will be executed, barring any modifications/insertions to existing facts, that may re-trigger rules out of order.
Thank You.
Upvotes: 0
Views: 1049
Reputation: 15179
You shouldn't be relying on execution order unless you have saliences assigned. During the matching stage, Drools will order the rules by salience (the default being zero). Within a salience there's no guaranteed execution order, though it's usually the order written. For multiple files, that's the order written to filesystem -- so it'll load each file sequentially and each rule inside each file sequentially.
While you're guaranteed that rules with salience 100 will fire before rules with salience 10, there's no guarantee about the order of rules within salience 100. Further, if your rule with salience 100 extends a rule with salience -1, that rule with salience -1 will consequentially fire before salience 10.
You should not write rules that depend on load order or anything like that. If your rules need to be executed in a particular order, use saliences. Otherwise write better rules that have mutually exclusive left-hand sides.
Upvotes: 2