[jboss-user] [jBPM] - Re: jbpm console doesnt see process instance that was started by java
Prasanth Manchambhatla
do-not-reply at jboss.com
Tue Jan 24 12:06:58 EST 2012
Prasanth Manchambhatla [https://community.jboss.org/people/pmancham] created the discussion
"Re: jbpm console doesnt see process instance that was started by java"
To view the discussion, visit: https://community.jboss.org/message/648463#648463
--------------------------------------------------------------
I think you have to start the process from jbpm-console to see that in the reports.
If you just want history, then you have to enable persistence in your java app that is running processes.
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
// create a new knowledge session that uses JPA to store the runtime state
StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
JPAWorkingMemoryDbLogger dblogger = new JPAWorkingMemoryDbLogger(ksession);
KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, "test", 1000);
ksession.getWorkItemManager().registerWorkItemHandler("myWorkItem", new MyWorkItemHandler());
int sessionId = ksession.getId();
ProcessInstance pi = (ProcessInstance) ksession.startProcess(processId);
System.out.println("Process started ... sessionId = " + sessionId + " processId = " + pi.getId());
logger.close();
dblogger.dispose();
ksession.dispose();
If you are using junit tests, then have a look at JBPMHelper.java in source code of jbpm5.2
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/648463#648463]
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/20120124/755308e0/attachment.html
More information about the jboss-user
mailing list