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.