[rules-users] Drools 6 support for changeset

Mark Proctor mproctor at codehaus.org
Fri Dec 13 20:40:18 EST 2013


update the releaseID in the meta model, build it (it’ll be added to KieRepository). Then on the KieContainer do updatetoVersion(String releaseId) giving it the release ID you wish to update to, and it will update at runtime.

Mark
On 13 Dec 2013, at 23:39, wtang <wtang at kana.com> wrote:

> Can I forget all this and just use KieFileSystem?
> 
> Again my requirement is when a rule changed, I need to run with the lastest
> changes WITHOUT bringing down the server and rebuild jar and redeploy.
> 
> I have the following code and getRule() is just reading the .drl rule as a
> string stored as a CLOB in the database:
> 
> KieServices ks = KieServices.Factory.get();
> KieRepository kr = ks.getRepository();
> KieFileSystem kfs = ks.newKieFileSystem();
> 
> kfs.write("src/main/resources/org/kie/example5/HAL5.drl", getRule());
> 
> if (ruleHasChanged()) {
>     KieBuilder kb = ks.newKieBuilder(kfs);
>     kb.buildAll(); // kieModule is automatically deployed to KieRepository
> if successfully built.
> }
> 
> KieContainer kContainer = ks.newKieContainer(kr.getDefaultReleaseId());
> KieSession kSession = kContainer.newKieSession();
> kSession.inserFact();
> KSession.fireAllRules();
> 
> So I will do:
> 
> 1) write my own logic to detect any rule changes in ruleHasChanged()
> 2) if any rules have changed, I will do buildAll() to build a new KieBase;
> otherwise, I don't call buildAll() and use the old KieBase.
> 
> Would this approach work per my requirement?
> 
> 
> 
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp4027138p4027289.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