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
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users