-
1. Re: Restore JBPM session
ravichandrankg Aug 9, 2012 5:45 PM (in response to newbird)I am also very much interested the answers for new bee's questions. Please reply for the clear understanding of JBPM5.
-
2. Re: Restore JBPM session
thomas.setiabudi Aug 9, 2012 10:55 PM (in response to newbird)Hi,
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.
Regards,
Thomas Setiabudi
-
3. Re: Restore JBPM session
newbird Aug 10, 2012 12:22 AM (in response to thomas.setiabudi)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?
-
4. Re: Restore JBPM session
thomas.setiabudi Aug 10, 2012 1:19 AM (in response to newbird)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?
Regards,
Thomas Setiabudi
-
5. Re: Restore JBPM session
newbird Aug 10, 2012 1:00 PM (in response to thomas.setiabudi)Hi Thomas,
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....
-
6. Re: Restore JBPM session
thomas.setiabudi Aug 12, 2012 9:12 PM (in response to newbird)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.
Regards,
Thomas Setiabudi
-
7. Re: Restore JBPM session
supritchaudhary Aug 13, 2012 5:27 AM (in response to newbird)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
ksession.getWorkItemManager().completeWorkItem(workItemId, null);
Once the workItem is complete the flow will process to next workItem.
Study this to restore session:
StatefulKnowledgeSession org.drools.persistence.jpa.JPAKnowledgeService.loadStatefulKnowledgeSession(int id, KnowledgeBase kbase, KnowledgeSessionConfiguration configuration, Environment environment)
-
8. Re: Restore JBPM session
hosein Sep 27, 2012 4:45 AM (in response to newbird)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
S.M.H.Jamali
-
9. Re: Restore JBPM session
svlada Jan 28, 2013 6:10 AM (in response to supritchaudhary)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?
-
10. Re: Restore JBPM session
rodmendiola Jan 28, 2013 10:58 AM (in response to newbird)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):
-
11. Re: Restore JBPM session
lauradp Jun 7, 2013 1:00 PM (in response to rodmendiola)sorry, can you descibe in a simpler way the workaround described?
thaks
Laura
-
12. Re: Restore JBPM session
tujasiri Mar 27, 2015 7:37 PM (in response to supritchaudhary)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.
-TU