jBPM 6.1 cannot resume process

﹥>﹥吖頭↗ 提交于 2020-01-17 03:59:15

问题


We can suspend a process instance like this :

org.jbpm.process.instance.ProcessInstance processInstance = //...;
processInstance.setState(STATE_SUSPENDED);

and to resume it :

kieSession.getWorkItemManager().completeWorkItem(processInstance.getId(), params);

but it doesn't work! ... what is the problem?

Thanks.


回答1:


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.

Try the following code:

    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());


来源:https://stackoverflow.com/questions/27303161/jbpm-6-1-cannot-resume-process

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!