JBoss Community

Re: Inserting new facts into a running process?

created by Miloud Haimoune in jBPM - View the full discussion

Hi,

 

First you need to add a AgendaEventListener to fire all rules automatically :

 

new AgendaEventListener() {

.....

 

   public void afterRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event,

                    WorkingMemory workingMemory) {

                  workingMemory.fireAllRules();

            }

 

second an other listner to update the working memery after a change on the processInstane

 

return new ProcessEventListener() {

....

public void afterVariableChanged(ProcessVariableChangedEvent event) {

      org.drools.runtime.rule.FactHandle handle = event.getKnowledgeRuntime().getFactHandle( event.getProcessInstance() );

       event.getKnowledgeRuntime().update( handle, event.getProcessInstance() );

}

 

more here : https://community.jboss.org/message/608017

 

HTH

Reply to this message by going to Community

Start a new discussion in jBPM at Community