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.
I’m basically trying to collect some session stats.
 
Here’s a snippet –
 
KnowledgeBaseConfiguration kbaseConf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
                kbaseConf.setOption(MBeansOption.ENABLED);
                commonKB = KnowledgeBaseFactory.newKnowledgeBase("kb-"+gameCode, kbaseConf);
                commonKB.addKnowledgePackages(kbuilder.getKnowledgePackages());
 
                StatefulKnowledgeSession session = commonKB.newStatefulKnowledgeSession();
 
 
               
                //session.addEventListener(bean.getAgendaStats());
               
                session.addEventListener(new DefaultAgendaEventListener() {
                        public void activationCancelled(ActivationCancelledEvent event) {
                                System.out.println("activation cancelled");
                        }
 
                            public void activationCreated(ActivationCreatedEvent event) {
                                 System.out.println("activation created");
                            }
 
                            public void afterActivationFired(AfterActivationFiredEvent event) {
                                 System.out.println("after activation fired");
                            }
 
 
                            public void beforeActivationFired(BeforeActivationFiredEvent event) {
                                 System.out.println("before activation fired");
                                 }
                            });
 
.. add facts..
Session.fireAllRules();
 
 
I never see the printlns or the breakpoints in the DefaultAgendaListener – are these supposed to be triggered when the rules are fired?