1. What is compileflow
Compileflow is a very lightweight, high performance, integrated and extensible process engine.
Compileflow Process engine is one of Taobao workflow TBBPM engines. It is a pure in-memory, stateless Process engine that converts flow files to Generate Java code for execution. Currently, it is the process engine of several core systems such as Alibaba business transactions in Taiwan.
Compileflow enables developers to design their own business processes through the process editor, visualizing complex business logic and bridging the gap between business designers and developers.
2. Function list
- High performance: Generated by converting process files
java
Code compilation and execution, concise and efficient. - Rich application scenarios: it is widely used in Alibaba zhongtai solution, supporting multiple business scenarios such as purchase guide, transaction, contract performance and capital.
- Integrability: Lightweight and concise design makes it extremely easy to integrate into various solutions and business scenarios.
- Complete plug-in support: Flow design is currently available
IntelliJ IDEA
,Eclipse
Plug-in support, which can be dynamically generated in real time during process designjava
Code and preview, what you see is what you get. - Export flow design diagrams
svg
Files and unit test code.
3, Quick Start
Step1: download and installIntelliJ IDEA
Plug-in (optional)
Download the plugin at github.com/alibaba/com…
Installation instructions: Please useIntelliJ IDEA
Local installation method to install, restartIntelliJ IDEA
It goes into effect.
Step2: POM
The plug-in
<dependency>
<groupId>com.alibaba.compileflow</groupId>
<artifactId>compileflow</artifactId>
<version>1.0.0</version>
</dependency>
Copy the code
The available version can be viewed at search.maven.org.
Note: Compileflow only supports JDK 1.8 and later.
Step3: Process design
The following uses KTV Demo as an example to explain how to configure nodes and attributes and use apis.
Demo description: N individuals to KTV singing, each sing a song, KTV consumption price is 30 yuan/person, if the total price is more than 300 10% off, less than 300 according to the original price payment.
S3.1
Create a BPM file as shown below:
Note:bpm
The file path must be andcode
To be consistent, process engine execution in file load mode will be based oncode
Find the file.
S3.2
Design the process through plug-ins or write the process XML file directly.
S3.3 Call process
Write the following unit tests:
public void testProcessEngine(a) {
final String code = "bpm.ktv.ktvExample";
final Map<String, Object> context = new HashMap<>();
final List<String> pList = new ArrayList<>();
pList.add("wuxiang");
pList.add("xuan");
pList.add("yusu");
context.put("pList", pList);
final ProcessEngine<TbbpmModel> processEngine = ProcessEngineFactory.getProcessEngine();
final TbbpmModel tbbpmModel = processEngine.load(code);
final OutputStream outputStream = TbbpmModelConverter.getInstance().convertToStream(tbbpmModel);
System.out.println(outputStream);
System.out.println(processEngine.getTestCode(code));
processEngine.preCompile(code);
System.out.println(processEngine.start(code, context));
}
Copy the code
compileflow
Native support taobao onlyBPM
Specification, for compatibilityBPMN 2.0
Specification, made a certain adaptation, but only support partBPMN 2.0
Element, which can be extended if supported by other elements.
4,For more information
- DEMO Quick Start
- Details of the original Taobao BPM specification