springboot integrates activiti+bpmn-js or VUE (Architecture Building Paper)

Don't use too much space for a concise introduction

Introduction to activiti

Activiti is a workflow engine. Actiti can extract complex business processes from the business system, define them using a specialized modeling language (BPMN2.0), and execute them according to pre-defined processes. Actiti manages the business processes of the business system and reduces the workload of system upgrade and transformation due to process changes.This improves the robustness of the system and reduces the cost of system development and maintenance.

Introduction to BPM

  • Bpm (Business Process Management), Business Process Management (BPM), is a systematic approach to continuously improve the business performance of an organization. BPM is included in common business management education such as EMBA, MBA, etc.

  • bpmn(Business Process Model and Notation), Business Process Model and Symbol.And bpm are two different concepts.Activiti uses the bmpn standard for process modeling.A standard set of business process modeling symbols developed by BPMI (Business Process Management Initiative) that use symbols provided by BPMN to create business processes.

springboot integration activiti

Actiti positioning is an auxiliary business system.

Actiti is included in the project (back-end process + built-in graphical designer if not recommended by open users)

Recommended Matching: Actiti Workflow Framework + bpmn-js or VUE Edition Front End github address
Actiti plug-in for development testing:

The following figure is bpmn-js


Is it friendly?

Start consolidation (outline)

  • pom reference
    <dependency>
        <groupId>org.activiti</groupId>
        <artifactId>activiti-spring-boot-starter-basic</artifactId>
        <version>5.22.0</version>
    </dependency>
  • application.yml file configuration
       # activiti default configuration
       #In the default configuration of activiti, process-definition-location-prefix is the prefix (i.e., path) that specifies the activiti process description file.
       #At startup, activiti looks for the process description file under this path and deploys it automatically; suffix is a String array that represents the default suffix name for the description file, which is the default of both.
       activiti:
         database-schema-update: true #Whether to update the database every time
         # Automatically deploy validation settings: true-on (default), false-off
         check-process-definitions: true # Whether activti deploys automatically
         process-definition-location-prefix: classpath:/processes/
         #process-definition-location-suffixes: .bpmn
         history-level: full
         #db-history-used: true
         db-identity-used: false
  • Create various services provided by activiti ActivitiConfig
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.activiti.spring.boot.AbstractProcessEngineAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import javax.sql.DataSource;
@Configuration
public class ActitytiSourceConfig extends AbstractProcessEngineAutoConfiguration {
    @Bean(name = "MyDataSource")
    @ConfigurationProperties(prefix = "spring.datasource")
    public DataSource MyDataSource(){
        return DataSourceBuilder.create().build();
    }
    @Bean
    public PlatformTransactionManager transactionManager() {
        return new DataSourceTransactionManager(MyDataSource());
    }
    @Bean
    public SpringProcessEngineConfiguration springProcessEngineConfiguration() {
        SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration();
        //Configuration database
        configuration.setDataSource(MyDataSource());
        configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
        configuration.setJobExecutorActivate(true);
        configuration.setTransactionManager(transactionManager());
        return configuration;
    }
}
  • start-up
    Success is marked by the database automatically generating tables for ACT_
  • Understanding database table names (translated into official documents)
    • Activiti's tables all start with ACT_The second part is a two-letter identification indicating the purpose of the table.The purpose also corresponds to the API of the service.
    • ACTRE*:'RE'means repository.The table with this prefix contains process definitions and static resources (pictures, rules, and so on).
    • ACTRU:'RU'means runtime.These runtime tables contain running data such as process instances, tasks, variables, asynchronous tasks, and so on.* Activiti only saves this data during process instance execution and deletes these records at the end of the process.This allows tables to run very small and fast all the time.
    • ACTID*:'ID'denotes identity.These tables contain identity information, such as users, groups, and so on.
    • ACTHI*:'HI'means history.These tables contain historical data, such as historical process instances, variables, tasks, and so on.
    • ACTGE*: general data for different scenarios.

This is the end of the integration.

Briefly describe the usage process in the activiti project (italicized based on your business)

  • Write process files for bpmn (understand bpmn standards)
  • Publish processes through the activiti engine
  • Own business preparation logic
  • Start process
  • Start Task
  • Process flow
  • End Task
  • Own Business End Logic

Summary: The usage process is roughly the same, and the rest is the API usage of activiti.Updates will follow...

Tags: Programming Database Spring JDBC SpringBoot

Posted on Sat, 09 May 2020 13:24:51 -0400 by bholaday