我试图在工作流执行完成后设置变量。
在 WorkflowStart 类中实例化工作流,然后获取值
ProcessInstance pi = runtimeService.startProcessInstanceByKey("workflowName");
System.out.println("runtimeService.getVariables(getId()) "+runtimeService.getVariables(pi.getId()));
上述命令启动工作流程,并执行所有执行。所以当我写
public class FlowDelegate implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
execution.setVariable("abc123", "123");
System.out.println("Execution variables - "+execution.getVariables());
}
}
上面的行打印
{
abc123 => Value '123' of type 'PrimitiveValueType[string]'
}
因此,在 processInstance 执行工作流并尝试访问变量之后,我得到了这个堆栈跟踪
并执行
System.out.println("runtimeService.getVariables(getId()) "+runtimeService.getVariables(pi.getId()));
ENGINE-16004 Exception while closing command context: execution e575eb8b-7b84-11e8-a237-54e1ad4a38ce doesn't exist: execution is null
org.camunda.bpm.engine.exception.NullValueException: execution e575eb8b-7b84-11e8-a237-54e1ad4a38ce doesn't exist: execution is null