[rules-users] Why does it seem like salience is being ignored?

Ladd ladd at codemettle.com
Sat Jul 14 11:19:39 EDT 2012


Thanks for the reply Mark!  However, in my test situation I'm never sending
Person objects, only Message objects.  The payload of the message contains
the Person object.  In my application there will be other types of payload
objects though.

In my test, Rule1a looks for messages containing persons:

> rule += "rule rule1a salience 100 \n"; 
> rule += "  when \n"; 
> rule += "    $m : Message( body.class == Person.class, $body : body ) \n"; 
> rule += "    $p : Person() from $body \n"; 
> rule += "  then \n"; 
> rule += "    System.err.println( \"rule1a: Just found person \" +
> $p.getName() ); \n"; 
> rule += "end\n"; 

I tried your suggestion and rule1b never fired because Person never exists
in memory (only messages that contain persons).

My goal is to have a "catchall" rule that catches all messages that haven't
been "caught" by other rules.  So every message in evaluates at least one
rule to true.  I figured rule with constraint "when Message()" with a low
salience would do that.  Since 1a and 1b both evaluate to true in my test, I
figured adjusting the salience would adjust the firing order.

Thanks for any insight you can offer!!!

- Ladd

--
View this message in context: http://drools.46999.n3.nabble.com/Why-does-it-seem-like-salience-is-being-ignored-tp4018669p4018682.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list