Skip to content

vvip2u/jbpm-quickstarts

Repository files navigation

I. Introduction

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.

II. Ready

Tools

Plugins

  • Drools
  • Eclipse Menu: Help->Eclipse Marketplace, then input the key Drools into the Find field

drools

Different eclipse version will cause different version of this plugin (the version on My PC is 8.x)


III. Quick Start

HelloWorld
[Get-it-Started]()
dependency

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

HelloWorld Sample

Hello World Sample Code:
download to-modify-here

Codes:
        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 & Transaction
  1. Persistence

    We choose Hibernate as the ultimate JPA tool.

  2. Transaction

    Configuration: (META-INF/persistence.xml)

        <persistence-unit name="xxxx" transaction-type="JTA">
            ...
        </persistence-unit>
    

    Configuration: (META-INF/persistence.xml)

        <persistence-unit name="xxxx" transaction-type="RESOURCE_LOCAL">
            ...
        </persistence-unit>
    
  3. 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.

Core Functions
  1. Process

    1. Activities

      hello
      a
      a

    2. Event

      hello
      a
      a

    3. Gateways

      hello
      a
      a

  2. Human Task

Other

IV. Integration

JPA
  1. DB
    1. H2
    2. Oracle
    3. MySQL
  2. Configuration
Spring
  1. Datasource
  2. JPA
  3. Restful WebService
Web Container
    System.out.println(“xxx”);

V. Summary

  • 进入{jbpm}目录
  • 修改eclipse的目录,打开build.properties,修改成自己的安装目录

如:eclipse.home=D:\programs\eclipse

  • 安装eclipse插件

ant install.droolsjbpm-eclipse.into.eclipse

  • 安装jbpm runtime插件

ant install.jBPM.runtime

About

jbpm-quickstarts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages