[jboss-user] [jBPM] - How to Send Signal Out from a WorkItemHandler?

Bruce Cui do-not-reply at jboss.com
Mon Jun 27 12:03:04 EDT 2011


Bruce Cui [http://community.jboss.org/people/brucecui] created the discussion

"How to Send Signal Out from a WorkItemHandler?"

To view the discussion, visit: http://community.jboss.org/message/612163#612163

--------------------------------------------------------------
I have been trying to implement multi-threading processes with jBPM, as well as time consuming batch tasks. I found the console was executing the processes in one same main thread, at least so appeared to me, so I tried to put the task logic in a Thread instance and started it in the WorkItemHandler. For single thread but time consuming tasks, which I need to wait for the return, I also passed the ProcessInstance as a parameter, so that when the thread finished its job, it could send out a signal togher with a return Object to notify the process to move forward. And while it was running, it would't occupy the main thread for long time.

Local testing seems fine, only the job wouldn't exit after all things done. Then I put all stuf on web, but this time I met several exceptions, saying like: "java.lang.IllegalArgumentException: IOException while storing workItem 1: org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl$1"

and "Could not commit session or rollback"

So I guess I should not pass the instance reference out, otherwise session may not be able to close or something. But is there a way to signal out from the WorkItemHandler or the Thread it starts, so that I can notify the process instance?

I see there are external signals, but it requires reference to ksession. But I didn't find a clue from either the docs or the API about acquire the ksession reference properly. Could you be so kind to help me out here? Or else I'll have to give up, since time consuming tasks running in the same main thread together will surely be a nightmare.


Thanks,

Bruce
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[http://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/20110627/8dade137/attachment.html 


More information about the jboss-user mailing list