yes.. you are missing that if you don't put the agenda group in the stack it will never be used.<br>Like Bali said "Whenever the focus is set<br>
to a different group, Drools adds this group to a stack". If you don't set the focus to another agenda group, the only one in the Stack is MAIN.<br><br><div class="gmail_quote">On Thu, Jan 21, 2010 at 1:11 PM, Pritam <span dir="ltr"><<a href="mailto:infinity2heaven@gmail.com">infinity2heaven@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
I'm not quite sure howDrools processes and partitions Agenda based on<br>
agenda-groups as the documentation conflicts with a real example. As per the<br>
documentation in Drools site and Michael Bali's book, page 102<br>
<br>
"Drools maintains a stack of Agenda groups. Whenever the focus is set to<br>
true, the active agenda-group is automatically changed to rule's agenda<br>
group. Drools maintains a stack of agenda groups. Whenever the focus is set<br>
to a different group, Drools adds this group to a stack. When there are no<br>
rules to fire from the agenda group, Drools pops from the stack and sets the<br>
agenda group to the next one."<br>
<br>
However, when I run a simple example with two rules having agenda groups<br>
set, none of the rules are fired unless the agenda-group is explicitly set<br>
to runtime. Based on the above example, I would expect Drools Agenda to run<br>
all rules under "MAIN" and since there are none, it should pop it out and<br>
point to the next available group and so on.<br>
<br>
Am I missing something here?<br>
<br>
<br>
package com.sample<br>
<br>
import com.sample.DroolsTest.Message;<br>
<br>
rule "Hello World"<br>
agenda-group "group1" # comment this and rule fires<br>
when<br>
m : Message( status == Message.HELLO, myMessage : message )<br>
then<br>
System.out.println( myMessage );<br>
m.setMessage( "Goodbye cruel world" );<br>
m.setStatus( Message.GOODBYE );<br>
update( m );<br>
end<br>
<br>
rule "GoodBye"<br>
agenda-group "group 2" # comment this and rule fires<br>
when<br>
Message( status == Message.GOODBYE, myMessage : message )<br>
then<br>
System.out.println( myMessage );<br>
end<br>
<br>
<br>
DroolsTest:-<br>
<br>
KnowledgeBase kbase = readKnowledgeBase();<br>
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();<br>
Message message = new Message();<br>
message.setMessage("Hello World");<br>
message.setStatus(Message.HELLO);<br>
ksession.insert(message);<br>
// ksession.getAgenda().getAgendaGroup("group1").setFocus(); // enable<br>
this only group1 is fired, not // group2<br>
ksession.fireAllRules();<br>
<font color="#888888">--<br>
View this message in context: <a href="http://n3.nabble.com/Understanding-agenda-group-doesn-t-work-as-documented-in-book-or-docs-tp133386p133386.html" target="_blank">http://n3.nabble.com/Understanding-agenda-group-doesn-t-work-as-documented-in-book-or-docs-tp133386p133386.html</a><br>
Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br> - <a href="http://salaboy.wordpress.com">http://salaboy.wordpress.com</a><br> - <a href="http://www.jbug.com.ar">http://www.jbug.com.ar</a><br> - Salatino "Salaboy" Mauricio -<br>