jBPM is a flexible Business Process Management (BPM) Suite. It makes the bridge between business analysts and developers. Traditional BPM engines have a focus that is limited to non-technical people only. jBPM has a dual focus: it offers process management features in a way that both business users and developers like it.
Tools
Plugins
Different eclipse version will cause different version of this plugin (the version on My PC is 8.x)
[Get-it-Started]()
jbpm-flow
jbpm-kie-services
jbpm-bpmn2
jbpm-audit
jbpm-human-task
jbpm-human-task-core
jbpm-human-task-jpa
jbpm-human-task-audit
jbpm-human-task-workitems
jbpm-test
knowledge-api
kie-api
kie-spring
drools-compiler
Hello World Sample Code:
download to-modify-here
KieBase kieBase = null;
KieHelper kieHelper = new KieHelper();
kieHelper.addResource(ResourceFactory.newClassPathResource("hello-world.bpmn"));
kieBase = kieHelper.build();
KieSession ksession = kieBase.newKieSession();
//Optional Log, will generate a file named basic-demo.log at the project root dirctory
KieRuntimeLogger logger = KieServices.Factory.get().getLoggers().newFileLogger(ksession, "basic-demo");
Map<String, Object> params = new HashMap<String, Object>();
params.put("name", "jake");
ProcessInstance processInstance = ksession.startProcess(PROCESS_ID, params);
log.info("processId: " + processInstance.getProcessId());
log.info("processName: " + processInstance.getProcessName());
// ProcessInstance.STATE_PENDING: 0
// ProcessInstance.ACTIVE 1
// ProcessInstance.STATE_COMPLETED 2
// ProcessInstance.STATE_ABORTED 3
// ProcessInstance.STATE_ABORTED 4
log.info("state: " + processInstance.getState());
ksession.dispose();
logger.close();
-
Persistence
We choose Hibernate as the ultimate JPA tool.
-
Transaction
Configuration: (META-INF/persistence.xml)
<persistence-unit name="xxxx" transaction-type="JTA"> ... </persistence-unit>
- NON-JTA
Configuration: (META-INF/persistence.xml)
<persistence-unit name="xxxx" transaction-type="RESOURCE_LOCAL"> ... </persistence-unit>
-
Datasource
- JTA
String dbUrl = "jdbc:h2:~/jbpm"; PoolingDataSource pds = new PoolingDataSource(); pds.setUniqueName("java:comp/env/jbpm/human-task"); pds.setClassName("bitronix.tm.resource.jdbc.lrc.LrcXADataSource"); pds.setMaxPoolSize(5); pds.setAllowLocalTransactions(true); pds.getDriverProperties().put("user", "admin"); pds.getDriverProperties().put("password", "admin"); pds.getDriverProperties().put("url", dbUrl); pds.getDriverProperties().put("driverClassName", "org.h2.Driver"); pds.init();
- Atomikos
- LOCAL
- DBCP
- C3p0
We choose Bitronix as the ultimate datasource tool.
- JTA
-
Process
-
Activities
hello
a
a -
Event
hello
a
a -
Gateways
hello
a
a
-
-
Human Task
- DB
- H2
- Oracle
- MySQL
- Configuration
- Datasource
- JPA
- Restful WebService
System.out.println(“xxx”);
- 进入{jbpm}目录
- 修改eclipse的目录,打开build.properties,修改成自己的安装目录
如:eclipse.home=D:\programs\eclipse
- 安装eclipse插件
ant install.droolsjbpm-eclipse.into.eclipse
- 安装jbpm runtime插件
ant install.jBPM.runtime