Drolov retreat causes the rule not to shoot

I come across some weird behavior in Drools 4.0.7, but maybe it's just because I don't understand how Drools works. Suppose there is a class "A" that has the property "property".

As facts, I have the following list A: A1, property = 123 A2, property = 345 A3, property = 123

I have two rules:

rule "Rule 1 - Remove all A that have property set to 123"
  salience 1000
  lock-on-active true
when
  $listOfAs : ArrayList collect(A( property == "123" ))
then
  for (Object a: $listOfAs ) {  
      retract (a)
  }
end

rule "Rule 2 - Do stuff with remaining A's"
  salience 900
  lock-on-active true
when
  $listOfAs : ArrayList collect(A())
then
...
end

- " 1" , 123. " 2" , , "listOfAs" ​​ A ( "345" ). , " 2" , , "", . "retract", " 2" .

- ?

.

+3
1

, "lock-on-active". , , .

lock-on-active:

" ." true " ".

+1

Source: https://habr.com/ru/post/1755014/


All Articles