[jboss-user] [jBPM] - Re: jbpm5 transaction commit
RuiHua Tang
do-not-reply at jboss.com
Thu Jul 14 04:43:01 EDT 2011
RuiHua Tang [http://community.jboss.org/people/trh3037] created the discussion
"Re: jbpm5 transaction commit"
To view the discussion, visit: http://community.jboss.org/message/615114#615114
--------------------------------------------------------------
here are my codes:
private static StatefulKnowledgeSession createKnowledgeSession(
KnowledgeBase kbase) {
EntityManagerFactory emf = (EntityManagerFactory) Constants.ctx
.getBean("entityManagerFactory");
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.TRANSACTION_MANAGER, Constants.ctx
.getBean("txManager"));
env.set(EnvironmentName.GLOBALS, new MapGlobalResolver());
Properties properties = new Properties();
properties
.put("drools.processInstanceManagerFactory",
"org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory");
properties.put("drools.processSignalManagerFactory",
"org.jbpm.persistence.processinstance.JPASignalManagerFactory");
KnowledgeSessionConfiguration config = KnowledgeBaseFactory
.newKnowledgeSessionConfiguration(properties);
StatefulKnowledgeSession session = null;
try {
session = JPAKnowledgeService.newStatefulKnowledgeSession(kbase,
config, env);
// session = kbase.newStatefulKnowledgeSession(null, env);
} catch (Exception e) {
e.printStackTrace();
}
return session;
}
public void onTest1(Event event) throws InterruptedException {
try {
ksession = JbpmAPIUtil.createKnowledgeSession("HelloProcess.bpmn");
logger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(
ksession, "testlog", 1000);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task",
new CommandBasedWSHumanTaskHandler(ksession));
dblogger = new JPAWorkingMemoryDbLogger(ksession);
Map<String, Object> params = new HashMap<String, Object>();
params.put("employee", "krisv");
instance = ksession.startProcess("HelloProcess");
System.out.println(instance.getId() + "************************"
+ instance.getState());
System.out.println(ksession.getProcessInstance(instance.getId()));
} catch (Throwable t) {
t.printStackTrace();
}
}
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/615114#615114]
Start a new discussion in jBPM at Community
[http://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/20110714/d998aebb/attachment.html
More information about the jboss-user
mailing list