I have a question about 2 Drools attributes - salience and no-loop
salience:
rule "Hello World"
salience -10
when
$m : Message( status == Message.HELLO, $myMessage : message )
then
System.out.println( $myMessage );
$m.setMessage( "Goodbye cruel world" );
$m.setStatus( Message.GOODBYE );
update( $m );
end
rule "GoodBye"
when
Message( status == Message.GOODBYE, $myMessage : message )
then
System.out.println( $myMessage );
end
We should expect the "GoodBye" rule to be fired first(since its salience is higher) however that doesn't happen and instead the "Hello World" rule gets fired up first and only then "GoodBye"
no-loop:
I understand that this attribute prevent from a rule to be executed to the same fact which will cause an infinite loop. My question is about an example about this attribute that I don't quite understand:
rule "interest calculation"
no-loop
when
$account : Account( )
then
modify($account) {
setBalance((long)($account.getBalance() * 1.03));
}
end
If there wasn't "no-loop" why that will cause an infinite loop?