[rules-users] Best way to have multiple kieBase dynamically

Mark Proctor mproctor at codehaus.org
Sat Feb 22 20:21:46 EST 2014


take a look at this kmodule.xml.  This is one maven project,and thus one jar, but with 1..n named kiebases in it. Each kiebase selects resources from different folders.
https://github.com/droolsjbpm/drools/blob/master/drools-examples/src/main/resources/META-INF/kmodule.xml

The model you are working with just creates the kmodule.xml that ends up in the jar.

Mark
On 23 Feb 2014, at 00:26, lukes <mail2lokesh at gmail.com> wrote:

> Thanks Mark for the reply.
> 
> you mean something like :
> 
> KieServices kieServices = KieServices.Factory.get();
> 
> KieModuleModel kieModuleModel = kieServices.newKieModuleModel();
> 
> for( File ruleFile  : ruleFiles)
> {
> KieBaseModel kieBaseModel1 = kieModuleModel.newKieBaseModel( "KBase1 ")
>        .setDefault( true )
>        .setEqualsBehavior( EqualityBehaviorOption.EQUALITY )
>        .setEventProcessingMode( EventProcessingOption.STREAM );
> KieBaseModel1.addPackage(java.lang.String s);
> ...
> }
> kfs.writeKModuleXML(kieModuleModel .toXML());
> this.kieBuilder = ks.newKieBuilder(kfs).buildAll();
> this.kContainer =
> this.kService.newKieContainer(this.kRepository.getDefaultReleaseId());
> 
> 
> biut wouldn't that create another jar ? And if some new ruleFile come, then
> do i have to create all the kieBases again or can i just create the new
> kieBase? And if i need to modify any of the drl file, then will it rebuild
> the whole kieBuilder ?
> 
> 
> 
> --
> View this message in context: http://drools.46999.n3.nabble.com/Best-way-to-have-multiple-kieBase-dynamically-tp4028247p4028249.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list