I am also very much interested the answers for new bee's questions. Please reply for the clear understanding of JBPM5.
What database do you use for the JBPM?
If you changed the default H2 Database to some other DB like MySQL or SQL Server, all the process instances data will be stored in the DB. so in the event of application crash, when you restart the application, the process instances data is still there in the Database.
I am aware that it will store process instance info in database........
But my question is, how it will restart incomplete processes? Where do we need to give configuration?
Do we need to explicitly write one more class to restart all incomplete processes after fetchin info from database?
I think the process should continue from before application crash point.
Lets take the com.sample.evaluation included in the jbpm5.3 full installer.
First step, we initiate the process instance lets say we pass in krisv as the employee name
Second step, krisv look at his task list and then complete his task
Third step, john look at his task list and then complete his task
Fourth step, Mary look at her task list, but when she tries to complete her task, application crash.
so we stop everything and restart
After restart, Mary should be able to see the task in the task list and complete it.
Isn't that the default behavior right now? Or do I misunderstand your question?
I am very thankful for your time.
You are giving the ideal behavior of workflow....
My question is, how it will know the restart point(The node where to start process again)........If it stores in database,what is the schema structure?
What if i don't want to restart incomplete processes...What shall i do?
As i told u, i am new one trying to understand work flow......Please help me in this aspect....
Hi new bee,
Have you tried to change the default H2 Database to some other Database like MySQL or SQL Server?
If you want to know the Database Schema structure, it is a good idea to do that since you will be able to see all the tables.
If you do not want to restart incomplete process, you can terminate the process and then start a new instance of the process.
Hi new bee,
JBPM do not provide automatic restore of process and session on server restart :-(
You have write your own management code for this service.
You will need to read process id of pending complete workItem and restart the process yourself.
Never process can only be started once. If process was in progress when server restarted then you can not start process again.
Yo can find out the last workItem and complete it by this code
Once the workItem is complete the flow will process to next workItem.
Study this to restore session:
Hi new bee
I had similar problem so that after an application server crash I couldn't resume my processes unless I start a new process ! for start a new process I need to initialize a new StatefulKnowledgeSession. so after such initialization I can resume my old processes.
Hope this helps
What are best practices for storing SessionID?
I am using Spring and my KnowledgeSession is defined as follows:
<jbpm:ksession id="ksession" type="stateful" kbase="kbase" > <jbpm:configuration> <jbpm:jpa-persistence> <jbpm:transaction-manager ref="txManager"/> <jbpm:entity-manager-factory ref="myEmf"/> </jbpm:jpa-persistence> </jbpm:configuration> </jbpm:ksession>
When I restart server, new SessionID is generated and I am able to retreive User tasks with this new SessionID.
Is this appropriate way to restore session, or some other mechanism (custom Session Managment) must be employed?
we have a singleton service holding a single session for workflows, everytime the server stopps a new session is created, I am not sure if this is the best approach, but it is working well for us, the only issue is that the DB gets populated with sessions that are not used anymore.
We have human tasks in the processes and as they are also persisted, after a server stop (or node "change" in a cluster) jbpm is able resume the workflow after completing the task.
The problem of resuming the process has been submitted as jira here (they also describe a workaround there):
sorry, can you descibe in a simpler way the workaround described?
I'm unable to find any code illustrating how you can use persistence to restart/resume a failed node. Please show me some examples that would allow me to do this. I've done everything here -- Chapter 8. Persistence and Transactions -- and my test program with two nodes -- -- works after persistence configurations have been done. However, I Have no idea how to implement the persistence tools to restart a failed process.