JBoss Community

Re: Problem with multiple sessions

created by Gareth Edwards in jBPM - View the full discussion

I have tidied up the code and removed any thing that I think might be causing the issue.

The WorkflowCurrentTaskHandler is now not really doing anything as an experiment.

also the WorkflowEventListener is just logging the node name.

 

I'm still getting the same behavior.

 



            public void startWorkFlow(boolean startProcess, final User user) {
                 this.completed = false;
                     JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(ksession);
                  String connectorName = "Hornet" + UUID.randomUUID().toString();

                  final AsyncHornetQHTWorkItemHandler humanTaskHandler = new AsyncHornetQHTWorkItemHandler(new AsyncHornetQTaskClient(connectorName), ksession, OnErrorAction.LOG);
                  humanTaskHandler.setIpAddress(ipAddress);
                  humanTaskHandler.setOwningSessionOnly(true);
                              final CMTDisposeCommand dc = new CMTDisposeCommand();
                              dc.setWorkitemhandler(humanTaskHandler);
  
                              ksession.getWorkItemManager().registerWorkItemHandler("Human Task", humanTaskHandler); 
                              ksession.getWorkItemManager().registerWorkItemHandler("UpdateWorkflowCurrentTask", new WorkflowCurrentTaskHandler(null, ksession.getId(), null));
                              ksession.addEventListener(new WorkflowEventListener(null, ksession.getId(), null));
                              ksession.addEventListener(new DefaultProcessEventListener(){
                                @Override
                                        public void afterProcessCompleted(ProcessCompletedEvent event){
                                     log.info("~~~~~~~~~Workflow Session:" + ksession.getId() + " Completed~~~~~~~~~");
                                                  log.info("Disposing of " + event.getProcessInstance().getProcessName() + "!");
                                                  ksession.execute(dc);
                                                  completed = true;
                                                  workflowSettings.setCompleted(true);
                                        }
                              }); 
  
                              if (startProcess)
                                        ksession.startProcess(workflowSettings.getWorkflowName(),workflowSettings.getWorkFlowData());
                    }

 

 


Reply to this message by going to Community

Start a new discussion in jBPM at Community