JBoss Community

Re: Invocation of rule task in JBPM - Using JPA and within Web App

created by Tihomir Surdilovic in jBPM - View the full discussion

Not sure why you say you cannot use AgendaEventListener? Can you elaborate?

Here is one example (you have to do a little bit of casting...)

 

 

final org.drools.event.AgendaEventListener agendaEventListener = new org.drools.event.AgendaEventListener() {

                public void activationCreated(ActivationCreatedEvent event,

                        WorkingMemory workingMemory){

                }

                public void activationCancelled(ActivationCancelledEvent event,

                          WorkingMemory workingMemory){

                }

                public void beforeActivationFired(BeforeActivationFiredEvent event,

                            WorkingMemory workingMemory) {

                }

                public void afterActivationFired(AfterActivationFiredEvent event,

                           WorkingMemory workingMemory) {

                }

                public void agendaGroupPopped(AgendaGroupPoppedEvent event,

                        WorkingMemory workingMemory) {

                }

 

                public void agendaGroupPushed(AgendaGroupPushedEvent event,

                        WorkingMemory workingMemory) {

                }

                public void beforeRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event,

                                   WorkingMemory workingMemory) {

                }

                public void afterRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event,

                        WorkingMemory workingMemory) {

                    workingMemory.fireAllRules();

                }

                public void beforeRuleFlowGroupDeactivated(RuleFlowGroupDeactivatedEvent event,

                                     WorkingMemory workingMemory) {

                }

                public void afterRuleFlowGroupDeactivated(RuleFlowGroupDeactivatedEvent event,

                                    WorkingMemory workingMemory) {

                }

            };

            ((StatefulKnowledgeSessionImpl)  ((KnowledgeCommandContext) ((CommandBasedStatefulKnowledgeSession) ksession)

                    .getCommandService().getContext()).getStatefulKnowledgesession() )

                    .session.addEventListener(agendaEventListener);

Reply to this message by going to Community

Start a new discussion in jBPM at Community