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

Wolfgang Laun wolfgang.laun at gmail.com
Sat Jul 14 12:22:25 EDT 2012


Both with 5.4.0 and 5.3.0 I can't reproduce the effect described by Ladd.
The inserts are of two Messages with Object body set to Person("...").
Knowledge Base is configured STREAM, but Message isn't an event.
-W


On 14/07/2012, Ladd <ladd at codemettle.com> wrote:
> 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.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list