You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "Niteshkumar152 (via GitHub)" <gi...@apache.org> on 2025/01/29 10:17:22 UTC

[I] When conditions of other rules with different agenda group are getting evaluated even though the focus is not set on them [incubator-kie-drools]

Niteshkumar152 opened a new issue, #6238:
URL: https://github.com/apache/incubator-kie-drools/issues/6238

   I am using drools version 8.44.0.Final.
   I have observed that the when conditions of other rules with different agenda group are getting evaluated even though the focus is not set on them.
   
   Below is the logic that I am using to apply a Rule on incoming requestFact, can you please suggest what is the thing that is being done incorrectly so that only the rule belonging to a specific agenda group gets executed.
   
   ```
   public boolean applyRule(RequestFact requestFact, String agendaGroup) {
   		
   		var kieSession = atomicKieContainer.get().newKieSession();
   		try {
   			kieSession.insert(requestFact);
   			if (isNotEmpty(agendaGroup) && isNotNull(kieSession.getAgenda().getAgendaGroup(agendaGroup))) {
   				kieSession.getAgenda().getAgendaGroup(agendaGroup).setFocus();
   				}
   			kieSession.fireAllRules();
   			
   		} catch (Exception e) {
   			
   			System.out.println("Drools Execution Failed");
   			System.out.println(e.getMessage())
   		} finally {
   			kieSession.destroy();
   		}
   		
   		return true;
   	}
   ```
   
   Thanks in advance!!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [I] When conditions of other rules with different agenda group are getting evaluated even though the focus is not set on them [incubator-kie-drools]

Posted by "mariofusco (via GitHub)" <gi...@apache.org>.
mariofusco closed issue #6238: When conditions of other rules with different agenda group are getting evaluated even though the focus is not set on them
URL: https://github.com/apache/incubator-kie-drools/issues/6238


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [I] When conditions of other rules with different agenda group are getting evaluated even though the focus is not set on them [incubator-kie-drools]

Posted by "mariofusco (via GitHub)" <gi...@apache.org>.
mariofusco commented on issue #6238:
URL: https://github.com/apache/incubator-kie-drools/issues/6238#issuecomment-2624014958

   This is working as expected and there isn't anything incorrect here. Due to node sharing a node can belong to more than one rule in more than one agenda-group, and this is why the rule evaluation has to be performed regardless of the active agenda-group.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org