I think that you can explore the options already suggested:
- guard condition
- agenda group
and also:
- no-loop, if you happen to have any rule looping around itself
- drools.halt( ) in the consequence, if you want to completely halt the
execution when a given rule matches.
Cheers,
Leo.
2010/9/21 Esteban Aliverti <esteban.aliverti(a)gmail.com>
If what you need is to fire just a subset of all the activated rules,
you
could use agenda-group attribute instead of activation-group.
Best,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Developer @
http://www.plugtree.com
- Blog @
http://ilesteban.wordpress.com
2010/9/20 Michael Anstis <michael.anstis(a)gmail.com>
You could consider using a "guard condition" e.g.
>
> rule 1
> when
> not Solved()
> <Your rule 1>
> then
> insert new Solved();
> ....
> end
>
> rule 2
> when
> not Solved()
> <Your rule 2>
> then
> insert new Solved();
> ....
> end
>
>
> If you only want one rule per "group" then have the grouping as a member
> of the guard condition.
>
> I'm not sure if you can cause the processing of activations to abort.
>
> 2010/9/20 Nadav Hashimshony <nadavh(a)gmail.com>
>
>> Hi
>>
>> Im using drools 5 with Guvnor 5
>> i set up 30 Technical rules and build a package to be used by my
>> drools-sample application.
>>
>> my probelm is as followed, some rule may conflict, i want to set up a
>> rule order and if one rule is caught then i want the drools to stop and not
>> continue to try other rules.
>>
>> ive use salience but it hasnt really done the trick.
>>
>> example:
>> my rules:
>>
>> rule "Rule-01"
>> salience 100
>> activation-group "group1"
>> ...
>> System.Out.Println("caught rule 1")
>> ....
>>
>> rule "Rule-02"
>> salience 100
>> activation-group "group1"
>> ...
>> System.Out.Println("caught rule 2")
>> ....
>>
>> rule "Rule-03"
>> activation-group "group2"
>> ...
>> System.Out.Println("caught rule 3")
>> ....
>>
>>
>> rule "Rule-04"
>> activation-group "group2"
>> ...
>> System.Out.Println("caught rule 4")
>> ....
>>
>>
>> actual result: lets say all 4 rules are cuaght, what i will see is as
>> followed
>>
>> ACTIVATION CREATED rule:Rule-01 activationId:Rule-01 [1] declarations:
>> BEFORE ACTIVATION FIRED
>> caught rule 1
>> ACTIVATION CANCELLED rule:Rule-2
>>
>> ACTIVATION CREATED rule:Rule-03 activationId:Rule-01 [1] declarations:
>> BEFORE ACTIVATION FIRED
>> caught rule 3
>> ACTIVATION CANCELLED rule:Rule-3
>>
>>
>> only one rule from each activation-group will be fired, and the first
>> group with the higher salience will fire first.
>>
>> what i would like is it one rule was caught to stop trying? is it
>> possible?
>>
>> Thanks, Nadav.
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users