For completeness, the code I'm currently using, which doesn't work is:
long workItemId = (long)commandMap.get("_workItemId"); CompleteWorkItemCommand completeCommand = new CompleteWorkItemCommand(workItemId, commandMap); KieServices kieServices = KieServices.Factory.get(); KieContainer kContainer = kieServices.getKieClasspathContainer(); KieSession kSession = kContainer.newKieSession(); WorkItemManager workItemManager = kSession.getWorkItemManager(); workItemManager.completeWorkItem(workItemId, commandMap); logger.info("Execute Complete"); kSession.dispose();
This executes with no errors, but the process instance is not moved on, and stays halted where it was.
Having tried a variety of methods... The only one that seems to work is:
RuntimeManager manager = RuntimeManagerRegistry.get().getManager(deploymentId);
RuntimeEngine engine = manager.getRuntimeEngine(EmptyContext.get());
KieSession kSession = engine.getKieSession();
WorkItemManager workItemManager = kSession.getWorkItemManager(); workItemManager.completeWorkItem(workItemId, commandMap);
Is this legit? Or is there a better way? Using 6.2.0.Final.