I am working on a requirement on updating rule dynamically. I have scheduler which picks rules from DB once in every one hour. The requirement is to discard the previously loaded rules entirely with the new set of rules read from DB.
Currently i have initialized the file system and that gets reinitialized every time the scheduler reads the rules every time.
private KieServices kieServices = KieServices.Factory.get();
private KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
public reinitialize() {
kieServices = KieServices.Factory.get();
kieFileSystem = kieServices.newKieFileSystem();
}
But i am not sure if this is a good approach. What i have read from Drools documentation is, the rules are written as a library with a POM file. I am not sure if this approach will end of with lots of in memory file system and at the end system will be very slow.
Can someone suggest the right way to replace the old rules with new rules dynamically?