Kill activity and flowable. Alibaba open source workflow engine compileflow user's Guide

What is compileflow

compileflow is a very lightweight, high-performance, integrated and scalable process engine.

compileflow Process engine is one of Taobao workflow TBBPM engines. It is a stateless process engine that focuses on pure memory execution. It generates java code by converting process files, which is concise and efficient. At present, it is the process engine of multiple core systems such as Alibaba business middle office transaction.

Compileflow allows developers to design their own business processes through the process editor, visualize the complex business logic, and build a bridge between business designers and development engineers. At present, there are not many people using compileflow and few star s. But the project has been iterative for several years. Incubated by Alibaba's internal process engine: https://github.com/alibaba/compileflow .

Design intent

We hope to provide end-to-end business process solutions from design to implementation for business development.

Provide a variety of process engines, from strategy to business capability, business capability to business process, business process to system, and finally realize the visual global architecture of business.

Design an efficient execution engine, realize the rapid combination or expansion of services, and improve the R & D response and interaction speed from idea to value.

Main characteristics

High performance: generate java code by converting process files, compile and execute, which is concise and efficient.

Rich application scenarios: it is widely used in Alibaba's medium platform solutions, supporting multiple business scenarios such as shopping guide, transaction, performance, capital and so on.

Integrability: lightweight and concise design makes it extremely convenient to integrate into various solutions and business scenarios. Perfect plug-in support: at present, process design is supported by IntelliJ IDEA and Eclipse Plug-in, which can dynamically generate java code and preview in real time in process design, what you see is what you get.

Support the export of svg files and unit test codes from process design diagrams.

Download the compileflow idea designer plug-in

Plug in download address: https://github.com/alibaba/compileflow-idea-designer

Installation instructions: please use the local installation method of IntelliJ IDEA for installation. Restarting IntelliJ IDEA will take effect.

Using tutorials

First open the idea new project and add the following configuration to pom.xml:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.1.RELEASE</version>
</parent>

<properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>com.alibaba.compileflow</groupId>
        <artifactId>compileflow</artifactId>
        <version>1.0.0-RC2</version>
    </dependency>
</dependencies>

Then write the startup class and create the main method.

@SpringBootApplication
public class CompileflowApplication {

    public static void main(String[] args) {
        SpringApplication.run(CompileflowApplication.class, args);
        System.out.println("CompileflowApplication start ok!!!");
    }

}

Then create a Case class.

@Component
public class RunCase {

    public void run() {
        //code defined in bpm file
        String code = "bpm.ktvExample";

        //Input parameters of execution process
        Map<String, Object> context = new HashMap<>();
        List<String> pList = new ArrayList<>();
        pList.add("Amateur grass");
        pList.add("Tao ");
        pList.add("WeChat: codedq");
        pList.add("have a nice weekend");
        context.put("pList", pList);

        try {
            ProcessEngine processEngine = ProcessEngineFactory.getProcessEngine();
            Map<String, Object> result = processEngine.start(code, context);
            System.out.println(result.get("price"));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void run2() {
        //code defined in bpm file
        String code = "bpm.sqrt";

        //Input parameters of execution process
        Map<String, Object> context = new HashMap<>();
        context.put("num", 4);

        try {
            ProcessEngine processEngine = ProcessEngineFactory.getProcessEngine();
            Map<String, Object> result = processEngine.start(code, context);
            System.out.println(result.get("numSqrt"));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}

Then create a Controller for test verification.

@RestController
public class DemoController {

    @Resource
    private RunCase runCase;

    @RequestMapping("/say")
    public String say() {
        return "Hello,compileflow.";
    }

    @RequestMapping("/run")
    public String run() {
        runCase.run();
        return "Run ok.";
    }

    @RequestMapping("/run2")
    public String run2() {
        runCase.run2();
        return "Run ok.";
    }
}

The two files in the code: bpm.sqrt and bpm.ktvExample can be designed through the compileflow-idea-designer plug-in.

compileflow-idea-designer

The designed process can automatically generate the corresponding Java code.

compileflow code

With the process file, we can run the whole demo.

If you are interested in working as a migrant worker, you can quickly get started and help improve the compileflow ecology and community.

summary

compileflow is extremely easy to use and reduces the difficulty of workflow learning.

There is a problem with the compatibility of the compileflow IDEA design plug-in in version 2021.

The automatically generated unit test code depends on a lower version and does not support Junit5.

Posted on Mon, 06 Dec 2021 23:50:58 -0500 by BigJohn