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

Mark Proctor mproctor at codehaus.org
Sat Feb 22 18:34:46 EST 2014


You need to specify the packages that the kiebase includes. That way different resources can be assigned to different kiebases
KieBaseModel.addPackage(java.lang.String s);

In the xml it’s a comma separated list packages=“"

Mark
On 22 Feb 2014, at 19:58, lukes <mail2lokesh at gmail.com> wrote:

> Hi,
> 
>  What's the best way to have multiple kieBases dynamically on
> same/different KieFileSystem. let's say if i have 3 different drl(this can
> grow dynamically, so don't want to put in kconfig.xml)l files and i want all
> three of them to reside in different kiebases so that each session(stateful
> and stateless) created from the kiebase can have it's independent set of
> rules. Currently i a doing something like below: 
> 
>       this.kFileSystem.write("com.sample" + filename + ".drl", content);
>       this.kBuilder = this.kService.newKieBuilder(this.kFileSystem);
>       this.kBuilder.buildAll(); // kieModule is automatically deployed to
> KieRepository if successfully built.
>       if (this.kBuilder.getResults().hasMessages(Level.ERROR)) {
>            throw new RuntimeException("Build Errors:\n" +
> this.kBuilder.getResults().toString());
>       }
>       this.kContainer =
> this.kService.newKieContainer(this.kRepository.getDefaultReleaseId());
> 
> 
> But here, everything goes in to the same knowledgeBase. The actual problems
> i am trying to solve are below :
> 1) If i'll rebuild 1 kieBuilder and kieContainer, others won't get affected
> and users can work on them at the same time during runtime. 
> 2) For the stateless sessions, there's no getAgendaGroup(name).setFocus(),
> so it won't have to execute all the rules in the universal kieBase in my
> case.
> 
> Thanks in advance.
> 
> 
> 
> 
> --
> View this message in context: http://drools.46999.n3.nabble.com/Best-way-to-have-multiple-kieBase-dynamically-tp4028247.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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140222/d8bc2706/attachment.html 


More information about the rules-users mailing list