In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the example analysis of spring boot activity project building for you. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
Spring boot activity project build initialize a spring boot project maven as long as the above one is fine activiti-spring-boot-starter-basic The following two are 6.0.0 org.activiti activiti-spring-boot-starter-basic ${activiti.version} org.activiti-- > activiti-spring-boot-starter-rest-api-- > ${activiti.version} for rest requests and protometheus statistics > org.activiti-- > activiti-spring-boot-starter-actuator-- > ${activiti.version}-- > modify startup file and application.yml
Exclude @ SpringBootApplication from the startup file (exclude = org.activiti.spring.boot.SecurityAutoConfiguration.class)
Application.yml should add & nullCatalogMeansCurrent=true to datasource.url, and the database table will be established automatically when the project starts.
Spring: activiti: database-schema-update: true job-executor-activate: true # asyncExecutorEnabled property setting true will replace the old Job executor history-level: full db-history-used: true check-process-definitions: true # automatic deployment verification settings: true- is enabled (default), False- closes datasource: driver-class-name: com.mysql.cj.jdbc.Driver password: url: jdbc:mysql:///?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true username: find other idea plugins to install the actiBPM plug-in Restart idea
Note: idea garbled solution: click idea- > help menu-> edit Custome Vm Option menu, and add a line-Dfile.encoding=UTF-8 restart to solve the garbled.
Set up a processes folder under the resource directory, and right-click the folder to create a new * .bpmn file to draw a flow chart (the default read path for spring boot bpmn is resource/processes/) similar to: start-> server_task- > user_task- > end four simple flow charts
New test case
StartProcessInstanceByKey (key), resource/processes/key.bpmn. Change the key.bpmn suffix to xml to modify the process id= "key" in xml
@ RunWith (SpringJUnit4ClassRunner.class) @ SpringBootTest public class activitTest {@ Autowired private RuntimeService runtimeService; @ Autowired private TaskService taskService; @ Test @ Deployment public void simpleProcessTest () {runtimeService.startProcessInstanceByKey ("myProcess_1"); Task task = taskService.createTaskQuery () .singleResult (); taskService.complete (task.getId ()) } @ Test public void queryProcessList () {ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery () .processDefinitionKey ("myProcess_1"); List list = query.list (); System.out.println (list.size ()); list.forEach (e-> {Task task = taskService.createTaskQuery () .processInstanceId (e.getProcessInstanceId ()) .singleResult (); taskService.complete (task.getId () );}}
It's ready to run up there.
To unite with our business, we need to build a new service.
The corresponding flowchart calls the following two methods
Four simple flowcharts: start-> server_task- > user_task- > end
Server_task plus activiti:expression= "# {bootTestService.begin (execution)}" | | server_task changes type=expression value=# {bootTestService.begin (execution)} to the flowchart to indicate monitoring
User_task plus activiti:candidateUsers= "${bootTestService.end ()}" | | user_task changes Candidate Users value=$ {bootTestService.end ()} to the flowchart.
Note: event monitoring starts with #
@ Servicepublic class BootTestService {public void begin (DelegateExecution execution) {System.out.println ("begint"); System.out.println (execution.getCurrentActivityId ()); System.out.println (execution.getEventName ()); System.out.println (execution.getTenantId ());} public List end () {System.out.println ("end"); return Arrays.asList ("hello", "hello");}}
The main table structure of the final execution unit test is as follows
/ / deployment table
Act_re_procdef field process_id field DEPLOYMENT_ID_
Act_re_deployment
Act_ge_bytearray
Act_ge_property
/ / Task list
Act_hi_procinst process instance table
The act_hi_taskinst PROC_INST_ID_ field is associated with the above table. EXECUTION_ID_ is associated with the following table.
Act_hi_actinst specific steps table
Introduction of Activiti 7 Servic
TaskService: in Activiti, each execution node in the business process definition is called a Task. Data access, state change and other operations in the process need to be completed in Task. Task Service provides operations related to Task and Form for users. It provides the functions of runtime task query, collection, completion, deletion and variable setting.
RuntimeService: in Activiti, each time a process definition is started, a corresponding process object instance is generated. Runtime Service provides the functions of starting the process, querying the process instance, setting and getting the process instance variable and so on. In addition, it provides access to process deployment, process definition and process instances.
RepositoryService: each different version of a business process definition in Activiti requires the use of definition files, deployment files, and supporting data (such as BPMN2.0 XML files, form definition files, process definition image files, etc.), which are stored in Activiti's built-in Repository. Repository Service provides access to repository.
HistoryService: HistoryService is used to obtain information about running or completed process instances. Unlike process information obtained in Runtime Service, historical information contains permanent information that has been persisted and has been optimized for queries.
FormService: both the process and status Task in Activiti can correlate business-related data. By using Form Service, you can access the form data needed to start and complete the task and render the form as needed.
IdentityService: user and group management functions are built into Activiti, and the information of these users and groups must be used to obtain the corresponding Task. Identity Service provides the ability to manage users and groups in the Activiti system.
ManagementService: ManagementService provides management and maintenance capabilities for the Activiti process engine, which are not used in workflow-driven applications and are mainly used for day-to-day maintenance of Activiti systems.
The tables used by Activiti start with ACT_. ACT_RE_*: 'RE' represents repository (storage), the table operated by the RepositoryService interface. Tables with prefixes contain static information, such as process definitions, process resources (pictures, rules, etc.). ACT_RU_*: 'RU' stands for runtime, the runtime table-RuntimeService. This is the runtime table that stores runtime data such as process variables, user tasks, variables, job, and so on. Activiti stores only run-time data during instance execution, and these records are deleted when the process instance ends. This ensures that these runtime tables are small and fast. ACT_ID_*: 'ID' represents the identity (organization), the table operated by the IdentityService interface. User records, users and groups used in the process. These tables contain identified information, such as users, user groups, and so on. ACT_HI_*: 'HI' stands for history, historical data table, HistoryService. It is these tables that contain historical data related to the execution of the process, such as finished process instances, variables, tasks, ACT_GE_*: global common data and settings (general), data used in various situations.
Serial number table name description
1 act_ge_bytearray binary data sheet
2 the act_ge_property attribute data table stores data at the level of the entire process engine. When initializing the table structure, three records are inserted by default.
3 act_hi_actinst Historical Node Table
4 act_hi_attachment Historical attachment Table
5 act_hi_comment Historical opinion form
6 act_hi_identitylink Historical process personnel Table
7 act_hi_detail history details table, which provides the query of history variables
8 act_hi_procinst Historical process example Table
9 act_hi_taskinst history task example table
10 act_hi_varinst historical variable scale
11 act_id_group user group information table
12 act_id_info user extension Information Table
13 act_id_membership user and user group corresponding information table
14 act_id_user user information table
15 act_re_deployment deployment information table
16 act_re_model process design model deployment table
17 act_re_procdef process definition data sheet
18 act_ru_event_subscr throwEvent, catchEvent time monitoring information table
19 act_ru_execution Runtime process execution instance Table
20 act_ru_identitylink runtime process personnel table, which mainly stores information about task nodes and participants
21 act_ru_job Runtime timing Task data sheet
22 act_ru_task Runtime Task Node Table
23 act_ru_variable Runtime process variable data sheet
This is the end of the sample analysis on the construction of the spring boot activity project. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.