-
1. Re: per-request runtime strategy and asynchronous execution
swiderski.maciej Aug 29, 2014 1:49 PM (in response to lauradp)you need to use runtime manager to get RuntimeEngine and then ksession before you can complete work item. See how it is done by jbpm executor here. This code is actually valid for all three runtime strategies.
HTH
-
2. Re: per-request runtime strategy and asynchronous execution
lauradp Sep 1, 2014 5:27 AM (in response to swiderski.maciej)thanks for your answer Maciej.
Here the methods for completing workitems:
private RuntimeManager getRuntimeManager() {
trace.debug("getRuntimeManager START");
RuntimeManager runtimeManager = RuntimeManagerRegistry.get().getManager(deploymentId);
if (runtimeManager == null) {
throw new IllegalStateException("There is no runtime manager for deployment " + deploymentId);
}
trace.debug("getRuntimeManager END");
return runtimeManager;
}
public void completeWorkItem(long processInstanceId, long workItemId, Map<String, Object> results) {
trace.debug("completeWorkItem START");
RuntimeManager manager = getRuntimeManager();
trace.debug("RuntimeManager created.");
ProcessInstanceIdContext processContext = ProcessInstanceIdContext.get(processInstanceId);
trace.debug("ProcessInstanceIdContext retrieved.");
RuntimeEngine engine = manager.getRuntimeEngine(processContext);
trace.debug("RuntimeEngine retrieved.");
// try {
engine.getKieSession().getWorkItemManager().completeWorkItem(workItemId, results);
// } finally {
// manager.disposeRuntimeEngine(engine);
// }
trace.debug("completeWorkItem START");
}
Laura