[rules-users] Drools AgendaEventListener

Agarwal, Beena BAgarwal at ea.com
Thu Nov 18 14:29:29 EST 2010


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?





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101118/a3774cba/attachment.html 


More information about the rules-users mailing list