Discussion:
[jboss-user] [jBPM] - Simple process with WorkItemHandler doesn't end
Jim B
2013-04-24 20:42:33 UTC
Permalink
Jim B [https://community.jboss.org/people/jamesbeam] created the discussion

"Simple process with WorkItemHandler doesn't end"

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

--------------------------------------------------------------
Using jBPM 5.4 with persistence (Hibernate 4, and JPA2) I have a 4 node process: 

*start*->*MyWorkItemHandler*->*Script* (System.out.println("done") ->(terminating) *end*.

The only thing my workItemhandler does is complete the workitem.   workItemManager.completeWorkItem(workItem.getId(),null);

The process starts, and the workitem handler completes.  I get the "done" printed on the screen.  I see in the NodeInstanceLog that my terminating end node is reached and completed (type=1).  I also set up a ProcessEventlistener and see that the afterProcessCompleted() gets called with the processID I'm expecting.

HOWEVER, my process is never marked as completed in the ProcessInstanceLog (Status = 0);

Has anyone seen this?  Does anyone have any thoughts as to what is going on?  A bug?

Thanks,

-J
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2013-04-25 08:25:38 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Simple process with WorkItemHandler doesn't end"

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

--------------------------------------------------------------
you mean that process is not reported as completed in history logs but it is in fact completed, right? If so, it could be a bug that is db specific. What db do you run with, is it oracle? Recently there was a fix for this but it was on master (6.0).

HTH
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Jim B
2013-04-29 19:58:00 UTC
Permalink
Jim B [https://community.jboss.org/people/jamesbeam] created the discussion

"Re: Simple process with WorkItemHandler doesn't end"

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

--------------------------------------------------------------
Thank you for the information.  Yes that is what I mean; and suspiciously, yes, I am running with Oracle (11g).  As you mentioned, it looks like the issue https://issues.jboss.org/browse/JBPM-3719 https://issues.jboss.org/browse/JBPM-3719.  As a work-around until 6 is released, does it seem reasonable to just add an update statement into my ProcessEventListener?  Something like:

   EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");
   EntityManager em = emf.createEntityManager();
   em.getTransaction().begin();
   ProcessInstanceLog pil = em.find(ProcessInstanceLog.class,event.getProcessInstance().getId());
   pil.setEnd(new Date());
   pil.setStatus(2);
   em.getTransaction().commit();
   em.close();

Thanks again,
-J
--------------------------------------------------------------

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

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