[jboss-user] [jBPM] - Re: jBPM5 Restarts and Asynchronous Work Items

Chris Melas do-not-reply at jboss.com
Thu May 19 04:36:20 EDT 2011


Chris Melas [http://community.jboss.org/people/melc] created the discussion

"Re: jBPM5 Restarts and Asynchronous Work Items"

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

--------------------------------------------------------------
Hello,
I'm not sure if that helps but I'm actually using jbpm in a similar manner and for the following issues i've taken the following corresponding actions,

i1.  when starting a custom work item (aka service task) that takes long the knowledgesession is not responsive as it is waiting for the process to finish
a1. run the custom work item asynchronously in a thread and when it completes call manager.completeWorkItem(workItem.getId(), results); within the executeWorkItem(WorkItem workItem, WorkItemManager manager) method of my custom work item handler

i2.  when running a custom work item that takes long the system might go down, so when the system restarts the tasks are not finished.
a2. the custom work items are actually persisted in the database by the jbpm, so if the system goes down before they've completed i've put some extra code to restart the work items present in the database as bootstrap code on the initialization of the system i.e. 
for (Object resultObject : results) { 
//where results are the rows from selecting the workitems from the database having name equal to my custom work items
                WorkItemInfo workItemInfo = (WorkItemInfo) resultObject;
                WorkItem workItem = workItemInfo.getWorkItem(ksession.getEnvironment());
                MyCustomWorkItemHandler myCustomWorkItemHandler = new MyCustomWorkItemHandler ();
                myCustomWorkItemHandler .executeWorkItem(workItem, ksession.getWorkItemManager());
            }

i3. multiple processes with the need to share the knowledge session
a3. create many processes even on different threads from the same knowledgesession

i4. multiple processes with no need to share the knowledge session
a4. create multiple knowledge session, whenever required, with one or more processes from each sessions

To be honest i haven't tested very much issues 3 and 4 but they seem to work.
I would greatly appreciate any ideas and comments, thanks
--------------------------------------------------------------

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

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/20110519/2fff571f/attachment.html 


More information about the jboss-user mailing list