[jboss-user] [jBPM] - Trouble getting human task from task service

TC ONG do-not-reply at jboss.com
Thu May 10 03:40:02 EDT 2012


TC ONG [https://community.jboss.org/people/devilkazuya99] created the discussion

"Trouble getting human task from task service"

To view the discussion, visit: https://community.jboss.org/message/734663#734663

--------------------------------------------------------------
Hi All,
I have a process that has multiple human tasks in it. I am using Human Task Service. I have problem getting the human task in 2 scenarios.

1> Greb human task right after process start.

...
knowledgeSession.startProcess(process, processVariables);    // start process
...
BlockingTaskSummaryResponseHandler taskSummaryHandler = new BlockingTaskSummaryResponseHandler();
taskClient.getTasksAssignedAsPotentialOwner(actor, "en-UK", taskSummaryHandler);
int taskSize = taskSummaryHandler.getResults().size();
logger.debug("Found " + taskSize + " task(s) from the Human Task Service.");
...

It gives me 0 results.
But if I go the database, the task was created.

Then I try Thread.sleep() for a while.

...
knowledgeSession.startProcess(process, processVariables);    // start process
try {
    logger.debug("Wait for 2 sec.");
    Thread.sleep(2000);
} catch (InterruptedException e) {
    e.printStackTrace();
}
...
BlockingTaskSummaryResponseHandler taskSummaryHandler = new BlockingTaskSummaryResponseHandler();
taskClient.getTasksAssignedAsPotentialOwner(actor, "en-UK", taskSummaryHandler);
int taskSize = taskSummaryHandler.getResults().size();
logger.debug("Found " + taskSize + " task(s) from the Human Task Service.");
...

and this time I got the result. 

Can I say that when I look for the human task, it is not created in the task service yet.
Obviously what I am doing is stupid and there is a better way to implement it. 
Can anyone enlighten me a little bit?


2> Second case is when I try to get the next task after completing one.
...
BlockingTaskOperationResponseHandler taskOperationHandler = new BlockingTaskOperationResponseHandler();
taskClient.complete(task1.getId(), actor, contentData, taskOperationHandler);
taskOperationHandler.waitTillDone(5000);
...
BlockingTaskSummaryResponseHandler taskSummaryHandler = new BlockingTaskSummaryResponseHandler();
taskClient.getTasksAssignedAsPotentialOwner(actor, "en-UK", taskSummaryHandler);
int taskSize = taskSummaryHandler.getResults().size();
logger.debug("Found " + taskSize + " task(s) from the Human Task Service.");
...



Again, anyone, someone, i need your great knowledge.. (ToT)
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/734663#734663]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120510/fcc17a2e/attachment.html 


More information about the jboss-user mailing list