【问题标题】:Drools Rule Engine - Multiple .drl file for different set of rules for different contextDrools Rule Engine - Multiple .drl file for different set of rules for different context
【发布时间】:2022-12-01 19:09:41
【问题描述】:
I am using spring boot drools. I would like to maintain say 3 different drl files for different context as the rules are different for different context. In this case should I create 3 key KieContainer for each context or is it possible to handle in just on kie container? Note: for each context I have to invoke only the corresponding drl rules
【问题讨论】:
标签:
jboss
drools
rules
rule-engine
【解决方案1】:
Based on the limited description, sounds like "different context" can be identified with a Knowledge Base (KieBase).
You can create 1 KJAR with the 3 different DRL files, making sure (e.g.: via package) they correspond to 3 different KieBases.
Something ~like:
<kmodule>
<kbase name="KBase1" packages="org.acme,org.context1" />
<kbase name="KBase2" packages="org.acme,org.context2" />
<kbase name="KBase3" packages="org.acme,org.context3" />
...
</kmodule>
Then you could create 1 KieContainer, which contains the single KJAR containing the "multiple contexts" (KieBases).
At that point, from the KieContainer, you can create a KieSession with the specific KieBase you want.