ฉันกำลังพยายามตั้งค่าตัวแปรระหว่างการดำเนินการเวิร์กโฟลว์หลังจากเสร็จสิ้นแล้ว
การสร้างอินสแตนซ์เวิร์กโฟลว์ในคลาส 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