[jboss-user] [jBPM] - Re: Processinstance not continue after restarting application.
tom sebastian
do-not-reply at jboss.com
Wed Jan 30 00:15:18 EST 2013
tom sebastian [https://community.jboss.org/people/tomsebastian] created the discussion
"Re: Processinstance not continue after restarting application."
To view the discussion, visit: https://community.jboss.org/message/795051#795051
--------------------------------------------------------------
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 http://docs.jboss.org/jbpm/v5.2/userguide/ch07.html#d0e2914)
// create the entity manager factory and register it in the environment
EntityManagerFactory emf =
Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" );
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
env.set( EnvironmentName.TRANSACTION_MANAGER,
TransactionManagerServices.getTransactionManager() );
// create a new knowledge session that uses JPA to store the runtime state
StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
// start the transaction
UserTransaction ut =
(UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
ut.begin();
// perform multiple commands inside one transaction
ksession.insert( new Person( "John Doe" ) );
ksession.startProcess( "MyProcess" );
// commit the transaction
ut.commit();
Now problem is solved . for more info see discussion at https://community.jboss.org/thread/195660
Thanks for ur help...
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/795051#795051]
Start a new discussion in jBPM at Community
[https://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/20130130/10982cc4/attachment.html
More information about the jboss-user
mailing list