我最近刚刚学习JBPM 4.3, 照着xyz20003的用户指南写了一个小的列子,如下:
processInstance = executionService.startProcessInstanceByKey("abcdefg",variables); Execution exec = processInstance.findActiveExecutionIn("state1"); executionService.signalExecutionById(exec.getId(), "to end1"); Assert.assertTrue(processInstance.isEnded());
<process name="simplea" key ="abcdefg" xmlns="http://jbpm.org/4.3/jpdl">
<start name="start1" g="280,48,48,48"> <transition name="to state1" to="state1" g="-59,-17"/> </start> <end name="end1" g="272,261,48,48"/> <state name="state1" g="269,156,92,52"> <transition name="to end1" to="end1" g="-47,-17"/> </state> </process>
最终junit判断processInstance.isEnded() 为false;
然后我重新修改代码打印调试信息
processInstance = executionService.startProcessInstanceByKey("abcdefg",variables); Execution exec = processInstance.findActiveExecutionIn("state1"); executionService.signalExecutionById(exec.getId(), "to end1"); Set<String> activityNames = processInstance.findActiveActivityNames(); if (activityNames == null) { System.out.println("current activityNames is null" ); } else { for (String name: activityNames) { System.out.println("activity name is "+name); } } Assert.assertTrue(processInstance.isEnded());
打印了activity name is state1
我想问的是:
executionService.signalExecutionById(exec.getId(), "to end1"); 这个语句不是会让流程走到下面一个state吗,为何触发之后状态还是active,怎么样走到end节点或者说下一个节点呢?