Search code examples
javadrools

only one rule fired can't able to figure out why not all rule executed which declared in drl file


I am new to drool. I have using drool 7. Here is my rule which I have written in drl file.

rule "initListFact" dialect "java" when     not List() then     insert( new ArrayList() ); end 

rule "TermAndConditionRequest_0_NOTNULL" when obj : TermAndConditionRequest(candidateId == null); result:ConstraintValidationResult(); In java I have created kieSession object then insert class object and fired rules:-

kieSession.insert(classObject);
    kieSession.insert(constraintValidationResult);
    List error = new ArrayList<String>();
    kieSession.setGlobal("errorList", error);
    kieSession.addEventListener(new DroolEventListener());
    int i = kieSession.fireAllRules();

I want to execute all rule which I have declared in .drl file but only "initListFact" rule only going to executed. Please help me out on this.


Solution

  • I have found the solution why its not working with spring-boot and no rule will be fired because of Drools does not work with spring-boot-devtools.

    If you add in pom.xml the following, no rules will be fired in Drools.

    <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-devtools</artifactId></dependency>
    

    if you comment out this, then rules will be fired correctly in Drools.

    Please follow the link for more info :https://issues.jboss.org/browse/DROOLS-1540

    Thanks