Flowable是19年基于activity开出的分支,大多业务场景只是使用activity走线上请假审核流程,实际上大厂里对flowable的使用更多是高并发状态下流程化、模板化功能开发。
一、概念
1、先贴6.4.x的中文版用户手册
https://jeesite.gitee.io/front/flowable/6.4.2/bpmn/index.html
2、Flowable是一个使用Java编写的轻量级业务流程引擎。
这就给Flowable更好的结合现在java微服务生态提供了可能。
二、集成开发
1、cse集成flowable
上文说到flowable是由java编写的,那么集成在spring、springboot、serviceCobm都是非常轻松的。
这里以serviceCobm为例展示,集成spring的案例官网就有,自不必多多说。
1.1引cse框架包
<dependencyManagement>
<dependencies>
<!--cse-->
<dependency>
<groupId>org.apache.servicecomb</groupId>
<artifactId>java-chassis-dependencies</artifactId>
<version>${servicecomb.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
1.2 引入flowable6.x.x 最新版已经到了6.6.0,查看了官网的升级介绍,对其中部分API做了更新,但大部分逻辑没有发生改变。
<!--flowable start-->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-engine</artifactId>
<version>6.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.flowable/flowable-spring -->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring</artifactId>
<version>6.4.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
<version>3.1.3</version>
</dependency>
<!--flowable end-->
三、配置流程引擎及服务引擎
配置流程引擎,有2中方式。
3.1 代码配置流程引擎
import lombok.Data;
import org.flowable.engine.*;
import org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
/**
* 功能说明
*
* @author asky
* @date 2021/7/18 0018 7:22
*/
@Configuration
@ConfigurationProperties(prefix = "spring.datasource")
@Data
class ProcessEngineConfig {
@Value("${spring.datasource.url}")
private String url;
@Value("${spring.datasource.driver-class-name}")
private String driverClassName;
@Value("${spring.datasource.username}")
private String username;
@Value("${spring.datasource.password}")
private String password;
/**
* 初始化流程引擎
* @return
*/
@Primary
@Bean(name = "processEngine")
public ProcessEngine initProcessEngine() {
// 流程引擎配置
ProcessEngineConfiguration cfg = null;
try {
cfg = new StandaloneProcessEngineConfiguration()
.setJdbcUrl(url)
.setJdbcUsername(username)
.setJdbcPassword(

本文介绍Flowable流程引擎的集成与应用实践,包括Flowable的概念、Spring Boot项目的集成方式、流程引擎的配置方法、流程部署与启动的示例,以及如何实现Java Delegate。
最低0.47元/天 解锁文章

740





