设置或更新 JBPM6 流程变量的正确方法 [英] Proper way to set or update JBPM6 Process Variables
本文介绍了设置或更新 JBPM6 流程变量的正确方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试设置过程变量,但出现以下错误
I am trying to set the process variable but getting below error
java.lang.IllegalStateException: Process instance 10[SampleBusinessProcess] is disconnected.
at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:100)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setVariable(WorkflowProcessInstanceImpl.java:343)
这是我的代码 -
ProcessInstance processInstance = runtimeEngine.getKieSession().getProcessInstance(processInstanceId);
((WorkflowProcessInstanceImpl) processInstance).setVariable("myvariable", "myvalue");
请帮助我设置流程变量的最佳方法.
Please help me with the best way to set the process variable.
谢谢.
推荐答案
我无法评论上一个答案,所以我发布了这个答案.
I can't comment on the previous answer so I'm posting this answer.
我发现的快速而肮脏的方法(灵感来自之前的答案)是:
The quick and dirty way I found (inspired from previous answer) is:
public void setProcessInstanceVariables(long processInstanceId, Map<String, Object> variables) {
kieSession.execute(new SetProcessInstanceVariablesCommand(processInstanceId, variables));
}
非常感谢 Kris Verlaenen!
Thanks a lot Kris Verlaenen!
这篇关于设置或更新 JBPM6 流程变量的正确方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文