Tihomir Surdilovic [http://community.jboss.org/people/tsurdilovic] created the 
discussion

"Re: Difficulties Invoking Rule Task"

To view the discussion, visit: http://community.jboss.org/message/628426#628426

--------------------------------------------------------------
Hi Tobias, there is a third options which IMO is some better than the other two 
which is to attach an AgendaEventListener to your ksession and fire the rules 
upon an RuleFlowGroupActivatedEvent. Here is an example which is a paste from 
CommandDelegate.java in the jBPM console:

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

Regarding >> but could the rules engine theoretically be exchanged / how 
tightly coupled is jBPM with the rules engine? <<
This is where the beauty of custom work items comes in  :)  You could write 
your work item to interact with any rule engine or service.

Hope this helps.
--------------------------------------------------------------

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

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

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to