yes.. you are missing that if you don&#39;t put the agenda group in the stack it will never be used.<br>Like Bali said &quot;Whenever the focus is set<br>
to a different group, Drools adds this group to a stack&quot;. If you don&#39;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">&lt;<a href="mailto:infinity2heaven@gmail.com">infinity2heaven@gmail.com</a>&gt;</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&#39;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&#39;s book, page 102<br>
<br>
&quot;Drools maintains a stack of Agenda groups. Whenever the focus is set to<br>
true, the active agenda-group is automatically changed to rule&#39;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.&quot;<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 &quot;MAIN&quot; 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 &quot;Hello World&quot;<br>
agenda-group &quot;group1&quot; # 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( &quot;Goodbye cruel world&quot; );<br>
                m.setStatus( Message.GOODBYE );<br>
                update( m );<br>
end<br>
<br>
rule &quot;GoodBye&quot;<br>
agenda-group &quot;group 2&quot; # 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(&quot;Hello World&quot;);<br>
message.setStatus(Message.HELLO);<br>
ksession.insert(message);<br>
// ksession.getAgenda().getAgendaGroup(&quot;group1&quot;).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 &quot;Salaboy&quot; Mauricio -<br>