Hi,
I'm fairly new to drools, and was curious if there is a way to reduce the
firing of rules.
Whenever a fact is modified, drools fires all rules who's parameter ( is the
same class type of the fact.
e. g.
<rule name="Order Level" salience="1" >
<parameter identifier="order">
<class>com.blah.shipping.ruleengine.Order</class>
</parameter >
<parameter identifier="item">
<class>com.blah.shipping.ruleengine.Item</class>
</parameter >
:
:
:
</rule>
Whenever we modify any fact of type object Item or type Order, this above rule
will fire.
Can we somehow specify a parameter based a sub-field of an object. Something
like
<rule name="Order Level" salience="1" >
<parameter identifier="order">
<class>com.blah.shipping.ruleengine.Order</class>
</parameter >
<parameter identifier="Item">
<instance>order.orderItem</instance>
</parameter >
:
:
:
</rule>
Where order.orderItem is of type Item. In this scenario, the rule will only
fire when an order fact or order.orderItem is modifed.
Right now, to emulate the behaviour I am looking for, I am doing a check in a
rule condition:
<rule name="Order Level" salience="1" >
<parameter identifier="order">
<class>com.blah.shipping.ruleengine.Order</class>
</parameter >
<parameter identifier="item">
<class>com.blah.shipping.ruleengine.Item</class>
</parameter >
<java:condition>order.orderItem == item</java:condition>
:
:
:
</rule>
Thanks,
Alan Ho