-
1. Re: Invocation of rule task in JBPM - Using JPA and within Web App
tsurdilovic Nov 26, 2011 11:50 PM (in response to ashpcs)1 of 1 people found this helpfulNot 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);