[rules-users] URGENT - using lock-on-active or not

Yaniv Itzhaki iyaniv at gmail.com
Thu Sep 16 03:55:47 EDT 2010


Hi All,



I have an urgent problem which I hope someone can explain it to me and how
it can be solved.



I created 2 rules "Update 1" and "Update 2", basically the rules are the
same, get all the CaseLog objects according to "Category" and "Value" and
update the Case, which holds a list of CaseLogs, with a new object.



Note that in the update method I am updating the working memory by
retracting the old log and inserting the new one.



Now for the problem:


The problem is that on one hand, when I insert a new log line all rules
without lock-on-active re-fire. On the other hand, rules with lock-on-active
seem to disregard the addition of the new object and fire only on the lines
that were present when their group was activated.



Please see the rules below



Thanks

Yaniv

* *

*rule* "Update 1"

      *salience* 4

      *ruleflow-group* "group1"

      *lock-on-active*

      *when*

            $case : Case()

            $myLog : CaseLog( myClass == "Category",

                  myValue == "1" )

      *then*

            System.out.println("Logic: Update 1");

            $case.update($myLog,40.0,*null*);

*end*

*rule* "Update 2"

      *salience* 0

      *ruleflow-group* "group1"

      *lock-on-active*

      *when*

            $case : Case()

            $myLog : CaseLog( myClass == "Category",

                  myValue == "1", $score : myScore )

      *then*

            System.out.println("Logic: Update 2 " + $score + 5.0);

            $case.update($myLog,$score + 5,*null*);

*end*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100916/f61320ab/attachment.html 


More information about the rules-users mailing list