1

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

  1. We need to define rules in a file

  2. KieFileSystem loads the rules into KieBuilder

  3. KieBuilder holds the knowledge base

  4. Based on KieBuilder we can prepare KieContainer & new KieSession

  5. 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?

BDL
  • 21,052
  • 22
  • 49
  • 55
ranafeb14
  • 437
  • 1
  • 7
  • 12
  • Not sure what you mean with "Spring Integration", but the `spring-integration` is indeed not what you have shown us: https://stackoverflow.com/questions/tagged/spring-integration – Artem Bilan Jul 07 '19 at 21:37
  • I mean spring integration with drools, do not find the tag spring-drools. – ranafeb14 Jul 08 '19 at 05:02
  • You can create one or just use `drools` and `Spring` as a combination, but it is definitely wrong to abuse tag for fully different purpose – Artem Bilan Jul 08 '19 at 13:24

0 Answers0