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

Vijay K Pandey VPandey at mdes.ms.gov
Thu Nov 19 14:21:40 EST 2009


You need to have at least the process instance id or the work item id to get your things done.



session.startProcess("processName"); ---- This will always starts a new process



You have to get hold of your process instance or you can directly complete the work item if you have the work item id.



StatefulKnowledgeSession ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, kbase, null,
getEnvironment());

WorkflowProcessInstance inst = (WorkflowProcessInstance)ksession.getProcessInstance(<<process instance id>>);

........get hold of the work item and complete it

                  OR
If you have the work item id already you can do this directly

ksession.getWorkItemManager().completeWorkItem(<<workitemid>>, null);





-----Original Message-----
From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Scott Stevenson
Sent: Thursday, November 19, 2009 11:00 AM
To: Rules Users List
Subject: [rules-users] How do I resume a paused process?



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



_______________________________________________

rules-users mailing list

rules-users at lists.jboss.org

https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091119/114f8733/attachment.html 


More information about the rules-users mailing list