-
1. Re: Processinstance not continue after restarting application.
thomas.setiabudi Jan 25, 2013 1:03 AM (in response to tomsebastian)Hi Tom Sebastian,
It was caused by the fact that after you restart the application there is no listener initialized to listen to the Task Complete Event sent by Human Task Service.
When you create new process instance, it will initialize this listener when it creates the Task, so thats why things works correctly after you trigger a new process instance.
If you embed the jbpm in your application then:
you will need to re-initialize the session once your application start.
If I remember correctly, there is a discussion in this forum that discuss about this, maybe that will help you.
If you use jbpm as a service (using jbpm-console REST Services), then:
I haven't tried this myself, but Maciej Swiderski suggest to create a servletContextListener that will initialize the session once the server is started.
this is the sample code
So we need to:
1. Create a class like that, then fill in the code in contextInitialized() section to initialize the section.
If you use guvnor as process repository and have guvnor deployed in the same server as jbpm-gwt-console-server.war then maybe you need to put a delay before initializing the session
2. Package the class to a jar and put it inside jbpm-gwt-console-server.war inside the lib directory
3. Register a listener to the web.xml inside jbpm-gwt-console-server.war
-
2. Re: Processinstance not continue after restarting application.
tomsebastian Jan 25, 2013 3:35 AM (in response to thomas.setiabudi)Hi,
Did u mean the task completed listener as below?
TaskEventKey key = new TaskEventKey(TaskCompletedEvent.class, -1);
TaskCompletedHandler eventResponseHandler = new TaskCompletedHandler(manager, client);
client.registerForEvent(key, false, eventResponseHandler);
I called this code while starting the application, still it wont continue. But in my code for every startup of application we create a new StatefulKnowledgeSession and new task client. Is this a problem?
-
3. Re: Processinstance not continue after restarting application.
thomas.setiabudi Jan 25, 2013 6:47 PM (in response to tomsebastian)Hi Tom Sebastian,
The new task client should not be a problem since I do that too.
Not sure about the new StatefulKnowledgeSession. Since I am using JBPM as a Service and jbpm console use single session. Can you try to persist your StatefulKnowledgeSession in database and reinitialize that StatefulKnowledgeSession on server start?
Regards,
Thomas Setiabudi
-
4. Re: Processinstance not continue after restarting application.
tomsebastian Jan 26, 2013 7:02 AM (in response to thomas.setiabudi)Hi,
Now I reinitialize the previous StatefulKnowledgeSession after restart. Still the same problem exists(not continuing to next step)..
But i have a doubt, should we do anything while stopping the application(ie do we need to explicitly persist sessioninfo ?). Actually i kill the application and the last modification date of sessioninfo is not changing at that time. Is anything we need to code?
-
5. Re: Processinstance not continue after restarting application.
tomsebastian Jan 30, 2013 12:15 AM (in response to tomsebastian)Hi ,
I got the solution.
Steps:
1. While restarting application, re-registers listeners to the task client.
2. In my case starting process was like this:
..
ProcessInstance pi = ksession.createProcessInstance("com.sample.bpmn", null);
ksession.startProcessInstance(pi.getId());
..
for such multiple command execution need to use transaction(see :http://docs.jboss.org/jbpm/v5.2/userguide/ch07.html#d0e2914)
Now problem is solved . for more info see discussion at https://community.jboss.org/thread/195660
Thanks for ur help...