[rules-users] Need help with setFocus

new2drools rkbeach at gmail.com
Tue Jun 23 22:42:03 EDT 2009


Hi All,

Need some help with understanding setFocus.

I have the following use case:

if (condition1) { 

  if (condition2) { 

  } else if (condition3) { 

  } else if (condition 4) { 

  } 

} 

if (condition5) { 

  if (condition2) { 

  } else if (condition3) { 

  } else if (condition 4) { 

  } 

} 

I created 3 rules (rule2, rule3, rule4) for checking condition2, condition3,
condition4 and 
created 1 agenda group (groupX) for them.

I created 2 rules (rule1, rule5) for checking condition1, condition5 and
created 1 agenda group(groupY) for them.

rule "rule1"
  agenda-group "groupY"

  when
    //
  then
   drools.setFocus("groupX");
end

rule "rule3"
  agenda-group "groupX"
  activation-group "someActiveGroup"
  
  when
    //
  then
   //
end

>From the java code:

ksession.getAgenda().getAgendaGroup("groupY").setFocus();

Problem: The first time, drools.setFocus("groupX") is invoked, I see that
it's working fine. rule2 or rule3 or rule4 get triggered. But, the SECOND
time that drools.setFocus("groupX") is invoked, I don't see that any rule in
agenda-group groupX is being invoked...even though one of the rule's LHS
explicitly matches...thinking that the activation-group is cancelling all
the activation's (after one rule in that activation group is fired), I even
removed the activation-group statement. But, it didn't help...ideally, I
would like to bunch rule2, rule3, rule4 in one activation group.

Can you please let me know as to why the second invocation of setFocus is
not working? I even tried to remove everything in LHS of rule2/3/4, to see
if the second invocation would work...it doesn't...

Thanks!!
-- 
View this message in context: http://www.nabble.com/Need-help-with-setFocus-tp24177742p24177742.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list