Hello list. I needed some expert advice related to implementing Rule inheritance in Drools. I will still consider myself new to Drools and trying to go through all the source code currently.


The requirement for rule inheritance that I have is as follows:


A set of rules are defined/implemented on an entity acting as a template for other entities. Any entity created using template entity will inherit rules defined in template. There may be hundreds of child entities created from parent template entity. Inheritance here supports the following:

1. All enabled rules from template are also enabled on child entity.

2. Child entity can over-ride one or more of the rules defined in template. Child entity may also change rule settings/disable them.

3. Child entity can also extend rule-base by adding its own rules which are not defined in template.


I know there has been mentioned in the list of not having support for rule inheritance in Drools yet, but no discussion of how to achieve it. So any insights will be greatly appreciated.


Also one of the design questions here is should we use separate rule-base for each child entity as well as template entity (there can be potentially hundreds of child entities for a given template) or should we try to use only one rule-base and provide support for inheritance using only custom agenda filtering. Usage of custom agenda filter may help with performance as it won’t require hundreds of rule-bases but may not be even feasible to what we are trying to accomplish here. Also it may result in other short-comings but I can’t visualize it just yet.





Kunal Shah