-
1. Re: Long lasting actions and presistance within nodes
brittm Aug 17, 2005 6:19 PM (in response to zeroconf)This isn't really a problem for JBPM.
First, in my experience, once a process instance has been saved , subsequent node completion will be recorded to the database whether you continue to call saveProcessInstance() or not (you just might not get all the logging you want).
Second, as for keeping the action handlers running when the user logs out, that's completely up to how and where you place the java code that actually kicks off the process execution--that's a java question, not a JBPM one.
Try this:* Create a new process instance in a java bean operating in a thread that will continue separately from your web page execution.
* In that bean, call saveProcessInstance() and signal() the process to continue from the start state.
* ...your user moves on (logs out), but your actions continue to run in the bean...
* User logs back in, and can see which states have been completed (they've been recorded to the database as the bean continues to run to completion). You might even have your action handler periodically update a process variable to indicate how far along it is in it's computation.
Does anyone know why this might not work?
-Britt -
2. Re: Long lasting actions and presistance within nodes
zeroconf Aug 18, 2005 3:38 AM (in response to zeroconf)thanks brittm for your helpfull response.
I already start the ProcessInstance in a thread and it keeps running
after logging out. So that seems to work.
But can you give me a hint how to get back the pointer from the running thread or ProcessInstance? (I know that is not really a jBPM related issue)
I'm starting the process from within a Portlet which is closely related to a Servlet.
Is it nessesary to use a Java Bean?
thanks in advance
zeroconf -
3. Re: Long lasting actions and presistance within nodes
brittm Aug 18, 2005 11:16 AM (in response to zeroconf)As long as your code keeps running after your user moves on, it doesn't matter what you use.
Your portlet/servlet/bean whatever should return the process instance id of the newly created process to the UI before continuing to process--either by returning the value directly for the user to record, or by persisting it in some other way in your application for future use by your UI.
You may want to maintain a listing in your application of all process instances that were started on a particular day or whatever, and let your users choose the one in which they are interested when they return. How you manage that will be totally up to you.
Remember that you can use process variables to store additional information about processes (like who they belong to, etc.) and use a JPBM or Hibernate query to return process instances based on that data.
-Britt