本文介绍了jBPM 6.1无法恢复过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们可以暂停这样的流程实例:
We can suspend a process instance like this :
org.jbpm.process.instance.ProcessInstance processInstance = //...;
processInstance.setState(STATE_SUSPENDED);
并恢复它:
kieSession.getWorkItemManager().completeWorkItem(processInstance.getId(), params);
但是它不起作用! ...是什么问题?
but it doesn't work! ... what is the problem?
谢谢.
推荐答案
要恢复进程,请使用processInstance.setState(ProcessInstance.STATE_ACTIVE). WorkItemManager可以对workItems(Web服务调用,人工任务,客户处理程序等)进行操作,而不是对processInstances进行操作.
To resume a process, use processInstance.setState( ProcessInstance.STATE_ACTIVE ). The WorkItemManager operates on workItems (web service calls, human tasks, customer handlers etc.) rather than processInstances.
尝试以下代码:
KieSession ksession=......
ProcessInstance processInstance = ksession.startProcess(......
//suspend:
SuspendProcessInstanceCommand susp=new SuspendProcessInstanceCommand();
susp.setProcessInstanceId(processInstance.getId());
ksession.execute(susp);
//confirm suspended:
assertEquals(ProcessInstance.STATE_SUSPENDED, ksession.getProcessInstance(processInstance.getId()).getState());
//resume:
ResumeProcessInstanceCommand res=new ResumeProcessInstanceCommand();
res.setProcessInstanceId(processInstance.getId());
ksession.execute(res);
//confirm active:
assertEquals(ProcessInstance.STATE_ACTIVE, ksession.getProcessInstance(processInstance.getId()).getState());
这篇关于jBPM 6.1无法恢复过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!