[rules-users] Help with using Agenda filter and firelimit with Web Guided decision tables

Edson Tirelli tirelli at post.com
Mon Feb 23 20:18:11 EST 2009


   Well found! Thanks for reporting. I will fix and let you know.

   Edson

2009/2/23 <guyt1122 at aim.com>

> Hi,
>
> I'm using *Drools 5.0M5* and *Web Guided decision tables*. What I want to
> be able to do is to create several decision tables under one package and
> then using an Agenda filter and firelimit option to fire one rule from a
> single decision table that I'm filtering.
>
> What I did to try and accomplish this is the following.  I notice that each
> row in the decision table has a rule name that matches the following format:
> "Row 1 DecisionTableName", "Row 2 DecisionTableName" ... "Row N
> DecisionTableName", so I create a *RuleNameEndsWithAgendaFilter *agenda
> filter to only accept rules that ends with "DecisionTableName". Then I call
> on the* StatefulSession.fireAllRules(AgendaFilter, fireLimit)* with my
> agenda filter and a *firelimit *of 1.
>
> What I'm noticing is some inconsistent behavior were the logic would work
> sometimes and not other times.  It seems to always works if there is a
> single decision table under the package.  After debuging the*StatefuleSession.fireAllRules(AgendaFilter, firelimit)
> *, I tracked down the issue to the way the *firelimit *count updated in
> the* "DefaultAgenda.fireAllRules(AgendaFilter, fireLimit)"* and with the *
> "DefaultAgenda.fireNextItem(AgendaFilter)"*.
>
> I may have misunderstood what the *firelimit *meant but it seems like the
> while loop in the *fireAllRules *always decrements the firelimit count
> regardless if the *DefaultAgenda.fireNextItem(AgendaFilter)* calls the *fireActivation
> *method or the *fireActivationCancelled* method.  I would perfer the *firelimit
> *count to only get decremented if the *fireNextItem *results in a *fireActivation
> *method call and I think the logic will work for my scenario.  Looking at
> the documenation, it look like the logic is geared towards focusing agenda
> groups, but I do not want to have maintain a agenda group column on my
> decision tables.  I want each decision table to be an agenda group
> automagically.
>
> I have included the following code showing the *firelimit *is always
> updated in the while loop below:
>
>     public int *fireAllRules*(AgendaFilter agendaFilter,
>                             int fireLimit) {
>         this.halt.set( false );
>         int fireCount = 0;
>         while ( continueFiring( fireLimit ) && fireNextItem( agendaFilter )
> ) {
>             fireCount++;
>             *fireLimit = updateFireLimit( fireLimit );*
>             this.workingMemory.executeQueuedActions();
>         }
>         if ( this.focusStack.size() == 1 && getMainAgendaGroup().isEmpty()
> ) {
>             // the root MAIN agenda group is empty, reset active to false,
> so it can receive more activations.
>             getMainAgendaGroup().setActive( false );
>         }
>         return fireCount;
>     }
>
>
> Thanks,
> Guy
>
> ------------------------------
> *A Good Credit Score is 700 or Above. See yours in just 2 easy steps!<http://pr.atwola.com/promoclk/100126575x1218822736x1201267884/aol?redir=http:%2F%2Fwww.freecreditreport.com%2Fpm%2Fdefault.aspx%3Fsc%3D668072%26hmpgID%3D62%26bcd%3DfebemailfooterNO62>
> *
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090223/83f75fd3/attachment.html 


More information about the rules-users mailing list