[jboss-user] [jBPM] - Drools/jBPM integration problem - firing drools rules from rule task node

John Joel Boss do-not-reply at jboss.com
Tue Feb 19 22:58:49 EST 2013


John Joel Boss [https://community.jboss.org/people/jjsaguit] created the discussion

"Drools/jBPM integration problem - firing drools rules from rule task node"

To view the discussion, visit: https://community.jboss.org/message/798470#798470

--------------------------------------------------------------
Hi all,

I have read from  https://community.jboss.org/message/627263#627263 https://community.jboss.org/message/627263 that to fire the rule, I must call fireAllRules() before the rule task node and so I added the listener sugested in the same thread:

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);


However, I am getting the following cast error:

Exception in thread "main" java.lang.ClassCastException: org.drools.impl.StatefulKnowledgeSessionImpl cannot be cast to org.drools.command.impl.CommandBasedStatefulKnowledgeSession
          at com.sample.ProcessMain.main(ProcessMain.java:79)

Can anyone help please? I'm using jBPM 5.4 with Drools 5.5.0
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/798470#798470]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130219/78b99bc7/attachment-0001.html 


More information about the jboss-user mailing list