JBoss Community

Re: Process variable and rule task

created by Cristiano Nicolai in jBPM - View the full discussion

Francesco,

 

I'm currently using a ProcessEventListener to insert the process in the working memory just before it starts and remove it after completed. In this way I can handle processes in the working memory in a generic way. But a made your suggestion and it works, what happens is that the process needs to be updated in the working memory after I change a process variable. Now my listener looks like this and seems to be working fine.

 

        

          @Override
          public void afterVariableChanged(ProcessVariableChangedEvent event) {
                    LOGGER.debug("{}", event);
                    LOGGER.debug("Updating ProcessInstance on working memory");
                    FactHandle handle = event.getKnowledgeRuntime().getFactHandle( event.getProcessInstance() );
                    if(handle != null){
                                   event.getKnowledgeRuntime().update( handle, event.getProcessInstance() );
                    }
          }

 

Many thanks!

Reply to this message by going to Community

Start a new discussion in jBPM at Community