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(a)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-tp402713...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users