[rules-users] Drools AgendaEventListener

Michael Anstis michael.anstis at gmail.com
Thu Nov 18 15:01:06 EST 2010


Here's a working example of using AgendaEventListener...

http://article.gmane.org/gmane.comp.java.drools.user/22375

Your example has the line attaching the AgendaEventListener to the session
commented out. This wouldn't help ;-)

Cheers,

Mike

2010/11/18 Agarwal, Beena <BAgarwal at ea.com>

>  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?
>
>
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101118/6b29b08d/attachment.html 


More information about the rules-users mailing list