-
1. Re: How to finish the processInstance
krisverlaenen Jun 30, 2011 8:44 PM (in response to trh3037)It would be useful if you could also paste your process, to figure out what else the process is doing.
Kris
-
2. Re: How to finish the processInstance
trh3037 Jun 30, 2011 10:46 PM (in response to krisverlaenen) -
3. Re: How to finish the processInstance
krisverlaenen Jul 4, 2011 10:56 AM (in response to trh3037)This all seems to be normal.
Why do you think that the processInstance is still active in this case?
If you do ksession.getProcessInstance(id) after completing the user task, do you get a process instance in state active? Or null?
Or are you looking at the processInstance variable in this case? As the processInstance variable in your code is a snapshot of the state of the process instance after starting it. Note that this process instance is disconnected, meaning that it will not update when the state of the process instance in the engine is updated. To get an updated state, you need to do ksession.getProcessInstance(id) again. In this case, this should return null, as the process instance has completed.
Kris
-
4. Re: How to finish the processInstance
trh3037 Jul 5, 2011 4:25 AM (in response to krisverlaenen)Thanks Kris .
I try to use the following case, it automatically ends, and remove the process record in the database.
In my understanding, when the process is finished, it will be deleted automatically:
When i finish all the tasks for the process instance and i found that the state of the instance is still '1' in the database
-
5. Re: How to finish the processInstance
trh3037 Jul 4, 2011 9:59 PM (in response to krisverlaenen)And now, I had another problem occurred .
When I finish the first task, the process can not start the second task
With the following pictures may be more clearer:
As far as I know, when the process is started, it will call WSHumanTaskHandler.executeWorkItem()
Meanwhile, when the task is ended, it will also to call WSHumanTaskHandler.executeWorkItem()
But the truth is it is not called
here is my codes:
/**
* start the process
*
* @param event
* @throws InterruptedException
*/
public void onTest1(Event event) throws InterruptedException {
try {
StatefulKnowledgeSession ksession = JbpmAPIUtil
.createKnowledgeSession("HelloProcess.bpmn");
// , "SampleHumanTaskFormVariables.bpmn"
logger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(
ksession, "testlog", 1000);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task",
new CommandBasedWSHumanTaskHandler(ksession));
dblogger = new JPAWorkingMemoryDbLogger(ksession);
Map<String, Object> params = new HashMap<String, Object>();
params.put("employee", "krisv");
ksession.startProcess("HelloProcess");
ksession.fireAllRules();
} catch (Throwable t) {
t.printStackTrace();
}
}
/**
* finish the task
*
* @param event
* @throws InterruptedException
*/
public void onTest2(Event event) throws InterruptedException {
try {
List<TaskSummary> tasks = JbpmAPIUtil
.getTasksAssignedAsPotentialOwner("krisv");
//Map data = new HashMap();
for (TaskSummary taskSummary : tasks) {
System.out.println(taskSummary.getId() + " : "
+ taskSummary.getName());
// data.put("priority", "High");
// data.put("modelNumber", "1234");
// data.put("quantity", "225");
JbpmAPIUtil.completeTask(taskSummary.getId(), null, "krisv");
}
dblogger.dispose();
logger.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
-
6. Re: How to finish the processInstance
jcharnet Jul 11, 2011 11:53 AM (in response to trh3037)I have the same problem.
I'm finishing my human task, with the taskClient API, calling start and complete on the human task. But my next task, (after the human task) never gets called.Do I need to do something else in my code ?
Thanks a lot.
John
-
7. Re: How to finish the processInstance
trh3037 Jul 13, 2011 10:36 PM (in response to jcharnet)I still have not resolved the problem,what about you?