[rules-users] How do I resume a paused process?

Scott Stevenson scott.stevenson at datacert.com
Thu Nov 19 12:00:03 EST 2009


I have a process that pauses after a few nodes are executed because it
reaches a Human Task node. I retrieve the persisted session with the
following code:

JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, kbase, null,
getEnvironment());

Once I have this session object I'm not sure how to resume the paused
process? I want to signal the Human Task work item as complete and have
the process resume at that point. I've tried this code:

WorkItemManager wm = session.getWorkItemManager(); 
wm.registerWorkItemHandler("Approve", new WSHumanTaskHandler());
WorkflowProcessInstance pi = (WorkflowProcessInstance)
session.startProcess("processName");
		 
Object[] nodes = pi.getNodeInstances().toArray();
WorkItem wi = ((HumanTaskNodeInstance) nodes[0]).getWorkItem();
wm.completeWorkItem(wi.getId(), null); 
session.dispose();

The result of this is that the workflow restarts from the first node and
completes to the end. I expected that the workflow would start at the
persisted location. What am I missing here? 


Scott Stevenson




More information about the rules-users mailing list