<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri, sans-serif" size="2">
<div>Can anyone explain when the ActivationCreatedEvent, BeforeActivationFiredEvent,AfterActivationFiredEvent are actually triggered? I added a AgendaEventListener on a StatefulKnowledgeSession and never see the events being fired when I’m in the debugger.</div>
<div>I’m basically trying to collect some session stats. </div>
<div> </div>
<div>Here’s a snippet – </div>
<div> </div>
<div><font face="Courier New, monospace" size="2">KnowledgeBaseConfiguration kbaseConf = KnowledgeBaseFactory.<i>newKnowledgeBaseConfiguration</i>();</font></div>
<div> <font face="Courier New, monospace" size="2">kbaseConf.setOption(MBeansOption.</font><font face="Courier New, monospace" size="2" color="#0000C0"><i>ENABLED</i></font><font face="Courier New, monospace" size="2">);</font></div>
<div> <font face="Courier New, monospace" size="2" color="#0000C0">commonKB</font><font face="Courier New, monospace" size="2"> = KnowledgeBaseFactory.</font><font face="Courier New, monospace" size="2"><i>newKnowledgeBase</i></font><font face="Courier New, monospace" size="2">(</font><font face="Courier New, monospace" size="2" color="#2A00FF">"kb-"</font><font face="Courier New, monospace" size="2">+</font><font face="Courier New, monospace" size="2" color="#0000C0">gameCode</font><font face="Courier New, monospace" size="2">,
kbaseConf);</font></div>
<div> <font face="Courier New, monospace" size="2" color="#0000C0">commonKB</font><font face="Courier New, monospace" size="2">.addKnowledgePackages(kbuilder.getKnowledgePackages()); </font></div>
<div> </div>
<div> <font face="Courier New, monospace" size="2" color="#0000FF"><u>StatefulKnowledgeSession</u></font><font face="Courier New, monospace" size="2"> session = </font><font face="Courier New, monospace" size="2" color="#0000C0">commonKB</font><font face="Courier New, monospace" size="2">.newStatefulKnowledgeSession();</font></div>
<div> </div>
<div> </div>
<div> </div>
<div> <font face="Courier New, monospace" size="2" color="#3F7F5F">//session.addEventListener(bean.getAgendaStats());</font></div>
<div> </div>
<div> <font face="Courier New, monospace" size="2" color="#3F7F5F">session.addEventListener(new DefaultAgendaEventListener() {</font></div>
<div><font color="#3F7F5F"> <font face="Courier New, monospace" size="2"> public void activationCancelled(ActivationCancelledEvent event) {</font></font></div>
<div><font color="#3F7F5F"> <font face="Courier New, monospace" size="2"> System.out.</font><font face="Courier New, monospace" size="2"><u>println</u></font><font face="Courier New, monospace" size="2">("activation </font><font face="Courier New, monospace" size="2"><u>cancelled</u></font><font face="Courier New, monospace" size="2">");</font></font></div>
<div><font color="#3F7F5F"> <font face="Courier New, monospace" size="2"> }</font></font></div>
<div> </div>
<div><font color="#3F7F5F"> <font face="Courier New, monospace" size="2"> public void activationCreated(ActivationCreatedEvent event) {</font></font></div>
<div><font color="#3F7F5F"> <font face="Courier New, monospace" size="2"> System.out.</font><font face="Courier New, monospace" size="2"><u>println</u></font><font face="Courier New, monospace" size="2">("activation created");</font></font></div>
<div><font color="#3F7F5F"> <font face="Courier New, monospace" size="2"> }</font></font></div>
<div> </div>
<div><font color="#3F7F5F"> <font face="Courier New, monospace" size="2"> public void afterActivationFired(AfterActivationFiredEvent event) {</font></font></div>
<div><font color="#3F7F5F"> <font face="Courier New, monospace" size="2"> System.out.</font><font face="Courier New, monospace" size="2"><u>println</u></font><font face="Courier New, monospace" size="2">("after activation fired");</font></font></div>
<div><font color="#3F7F5F"> <font face="Courier New, monospace" size="2"> }</font></font></div>
<div> </div>
<div> </div>
<div><font color="#3F7F5F"> <font face="Courier New, monospace" size="2"> public void beforeActivationFired(BeforeActivationFiredEvent event) {</font></font></div>
<div><font color="#3F7F5F"> <font face="Courier New, monospace" size="2"> System.out.</font><font face="Courier New, monospace" size="2"><u>println</u></font><font face="Courier New, monospace" size="2">("before activation fired");</font></font></div>
<div><font color="#3F7F5F"> <font face="Courier New, monospace" size="2"> }</font></font></div>
<div><font color="#3F7F5F"> <font face="Courier New, monospace" size="2"> });</font></font></div>
<div><font color="#3F7F5F"> </font></div>
<div style="padding-left: 54pt; "><font face="Courier New, monospace" size="2" color="#3F7F5F">.. add facts.. </font></div>
<div style="padding-left: 54pt; "><font face="Courier New, monospace" size="2" color="#3F7F5F">Session.fireAllRules();</font></div>
<div style="padding-left: 54pt; "><font face="Courier New, monospace" size="2" color="#3F7F5F"> </font></div>
<div style="padding-left: 54pt; "><font face="Courier New, monospace" size="2" color="#3F7F5F"> </font></div>
<div>I never see the printlns or the breakpoints in the DefaultAgendaListener – are these supposed to be triggered when the rules are fired? </div>
<div> </div>
<div> </div>
<div><font color="#3F7F5F"> </font></div>
<div> </div>
<div> </div>
</font>
</body>
</html>