I am a newbie to Drools, Need some clarificatoins on Drools - Spring Integration.
public KieFileSystem kieFileSystem() throws IOException {
KieFileSystem kieFileSystem = getKieServices().newKieFileSystem();
for (Resource file : getRuleFiles()) {
kieFileSystem.write(ResourceFactory.newClassPathResource(RULES_PATH + file.getFilename(), "UTF-8"));
}
return kieFileSystem;
}
public KieContainer kieContainer() throws IOException {
final KieRepository kieRepository = getKieServices().getRepository();
kieRepository.addKieModule(new KieModule() {
public ReleaseId getReleaseId() {
return kieRepository.getDefaultReleaseId();
}
});
KieBuilder kieBuilder = getKieServices().newKieBuilder(kieFileSystem());
kieBuilder.buildAll();
return getKieServices().newKieContainer(kieRepository.getDefaultReleaseId());
}
My understaing as per the documentation & few examples
We need to define rules in a file
KieFileSystem loads the rules into KieBuilder
KieBuilder holds the knowledge base
Based on KieBuilder we can prepare KieContainer & new KieSession
On KieSessoin we include the facts and fire the rules.
Question 1: What is the importance of KieModule, KieRepository, ReleaseId?
Question 2: I have seperate directories for different flows. How can I load specific rules based on flow?