LiteFlow is a lightweight, fast, stable and choreographable component process engine

LiteFlow is a lightweight, fast, stable and choreographable component process engine

2022-09-16 0 621
Resource Number 38576 Last Updated 2025-02-24
¥ 0USD Upgrade VIP
Download Now Matters needing attention
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

The LiteFlow recommended in this issue is a lightweight, fast, stable and orchestrable component-based process engine.

LiteFlow is a lightweight, fast, stable and choreographable component process engine插图

LiteFlow architecture

Function of LiteFlow framework

LiteFlow is designed to decouple complex logic. If you want to write or refactor complex business logic, LiteFlow is the most suitable. It is a lightweight, fast component-based process engine framework, component orchestration, helps decouple business code so that each business fragment is a component, and supports hot-load rule configuration for instant modification.

With LiteFlow, you need to break up complex business logic into small pieces of code and define a rule flow configuration. In this way, all the components can be configured according to your rules for complex flow.

What scenarios does LiteFlow apply to

LiteFlow is suitable for businesses with complex logic, such as price engines, order processes, etc., which often have many steps that can be broken down into individual components according to business granularity for assembly reuse changes. With LiteFlow, you get a flexible, scalable system. Because the components are independent of each other, you can avoid the risk of changing one place and disrupting the whole body.

Project characteristics

  • Decoupled orchestration tool for complex services, providing a unified implementation for all components
  • Orchestrate process based on rule file, support xml,json,yml three rule file writing methods
  • The framework provides the local file configuration source, the implementation of zk configuration source
  • The framework provides custom configuration sources that can be loaded from anywhere by implementing only one interface
  • supports automatic assembly of SpringBoot, as well as Spring configuration and non-Spring projects
  • Provides serial and parallel modes, and provides common and common expression statements
  • You can define scripting language nodes and support both QLExpress and Groovy scripts
  • Components can support retries, and each component can customize retry configurations and specify exceptions
  • Provides stepless nested explicit flow mode, implicit flow mode
  • data slot isolation mechanism, context independent and stable under multiple concurrent
  • Support elegant smooth hot refresh feature
  • Very low system loss, can be stably run in the core business of large-scale microservices
  • Comes with simple monitoring to know the running time ranking of each component

Integrated SpringBoot

LiteFlow provides it
liteflow-spring-boot-starter dependency package, providing automatic assembly function

< dependency> 
  <groupId>com.yomahub</groupId>
  <artifactId>liteflow-spring-boot-starter</artifactId>
  <version>2.6.10</version>
</dependency>

Configuration – Component definition

After relying on the above jar packages. You need to define and implement components that SpringBoot scans and registers in the context

@Component("a")
public class ACmp extends NodeComponent  {
    @Override
    public void process() {
        //do your business
    }
}

SpringBoot配置文件

liteflow.rule-source=config/flow.xml
< span class = "HLJS - the comment" > # -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the following non must -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- < / span >
#liteflow Whether to enable, default is true
liteflow.enable=true
 Whether the banner of #liteflow is enabled, defaults to true
liteflow.print-banner=true
#zkNode node, only if zk is used as the configuration source 
liteflow.zk-node=/lite-flow/flow
# Number of slots, default is 1024
liteflow.slot-size=1024
# Thread pool Builder for parallel nodes, LiteFlow provides the default Builder
liteflow.thread-executor-class=com.yomahub.liteflow.thread.LiteFlowDefaultExecutorBuilder
# Maximum wait time for asynchronous threads in seconds (only for when), default is 16
liteflow.when-max-wait-seconds=20
# Maximum number of threads in asynchronous thread pool, default is 16
liteflow.when-max-workers=16
# Number of asynchronous thread pool waiting queues, default is 512
liteflow.when-queue-limit=512
# Whether to parse the rule at startup, default to true
liteflow.parse-on-start=true
# Global retries, default is 0
liteflow.retry-count=0
# Whether to support the mixing of different loading modes, the default is false
liteflow.support-multiple-type=false
# Whether to enable monitoring log printing, the default is false
liteflow.monitor.enable-log=true
# Monitor queue storage size, default is 200
liteflow.monitor.queue-limit=300
# Monitor how much execution is delayed initially, the default is 300,000 milliseconds, which is 5 minutes 
liteflow.monitor.delay=10000
# How often does the monitor log print take place? The default value is 300000 milliseconds, which is 5 minutes 
liteflow.monitor.period=10000

Definition of the rule file

At the same time, you have to define the rules in config/flow.xml under resources:

< ? xml version="1.0" encoding="UTF-8"? > 
< flow> 
    <chain name="chain1">
        <then value="a,b,c"/>
        <when value="d,e"/>
    </chain>
</flow>

执行

Then you can get flowExecutor in any class and execute the link

@Component
public class MainTest{
    
    @Resource
    private FlowExecutor flowExecutor;
    
    @Test
    public void testConfig(){
        LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain1", "arg");
    }
}

Performance

Most of LiteFlow’s work is done at startup, including parsing rules, registering components, and assembling meta information. There is almost no additional cost to the system when the link is executed. The framework was designed from the start for the company’s core business, with particular attention to performance issues. Therefore, the core code is also optimized in terms of performance.

In the actual performance, LiteFlow execution efficiency is very high, in the core business of the company, the link composed of more than 50 business components, in the actual pressure test of a single point reached 1500 TPS, but also experienced double 11, star top flow with goods and other large traffic tests.

Test Example

The business is a price calculation engine with 11 business nodes, rich business logic, but the data is mock, without database IO.

A pressure test was conducted based on this Demo business. The pressure test machine was mac m1 pro and the pressure test tool was apache jmeter. The pressure test results were as follows:

LiteFlow is a lightweight, fast, stable and choreographable component process engine插图1

100 concurrent

LiteFlow is a lightweight, fast, stable and choreographable component process engine插图2

300 concurrent

资源下载此资源为免费资源立即下载
Telegram:@John_Software

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

Ictcoder Free source code LiteFlow is a lightweight, fast, stable and choreographable component process engine https://ictcoder.com/kyym/liteflow-is-a-lightweight-fast-stable-and-choreographable-component-process-engine.html

Share free open-source source code

Q&A
  • 1, automatic: after taking the photo, click the (download) link to download; 2. Manual: After taking the photo, contact the seller to issue it or contact the official to find the developer to ship.
View details
  • 1, the default transaction cycle of the source code: manual delivery of goods for 1-3 days, and the user payment amount will enter the platform guarantee until the completion of the transaction or 3-7 days can be issued, in case of disputes indefinitely extend the collection amount until the dispute is resolved or refunded!
View details
  • 1. Heptalon will permanently archive the process of trading between the two parties and the snapshots of the traded goods to ensure that the transaction is true, effective and safe! 2, Seven PAWS can not guarantee such as "permanent package update", "permanent technical support" and other similar transactions after the merchant commitment, please identify the buyer; 3, in the source code at the same time there is a website demonstration and picture demonstration, and the site is inconsistent with the diagram, the default according to the diagram as the dispute evaluation basis (except for special statements or agreement); 4, in the absence of "no legitimate basis for refund", the commodity written "once sold, no support for refund" and other similar statements, shall be deemed invalid; 5, before the shooting, the transaction content agreed by the two parties on QQ can also be the basis for dispute judgment (agreement and description of the conflict, the agreement shall prevail); 6, because the chat record can be used as the basis for dispute judgment, so when the two sides contact, only communicate with the other party on the QQ and mobile phone number left on the systemhere, in case the other party does not recognize self-commitment. 7, although the probability of disputes is very small, but be sure to retain such important information as chat records, mobile phone messages, etc., in case of disputes, it is convenient for seven PAWS to intervene in rapid processing.
View details
  • 1. As a third-party intermediary platform, Qichou protects the security of the transaction and the rights and interests of both buyers and sellers according to the transaction contract (commodity description, content agreed before the transaction); 2, non-platform online trading projects, any consequences have nothing to do with mutual site; No matter the seller for any reason to require offline transactions, please contact the management report.
View details

Related Article

make a comment
No comments available at the moment
Official customer service team

To solve your worries - 24 hours online professional service