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 998
Resource Number 38576 Last Updated 2025-02-24
¥ 0HKD 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/liteflow-is-a-lightweight-fast-stable-and-choreographable-component-process-engine/

Share free open-source source code

Q&A
  • 1. Automatic: After making an online payment, click the (Download) link to download the source code; 2. Manual: Contact the seller or the official to check if the template is consistent. Then, place an order and make payment online. The seller ships the goods, and both parties inspect and confirm that there are no issues. ICTcoder will then settle the payment for the seller. Note: Please ensure to place your order and make payment through ICTcoder. If you do not place your order and make payment through ICTcoder, and the seller sends fake source code or encounters any issues, ICTcoder will not assist in resolving them, nor can we guarantee your funds!
View details
  • 1. Default transaction cycle for source code: The seller manually ships the goods within 1-3 days. The amount paid by the user will be held in escrow by ICTcoder until 7 days after the transaction is completed and both parties confirm that there are no issues. ICTcoder will then settle with the seller. In case of any disputes, ICTcoder will have staff to assist in handling until the dispute is resolved or a refund is made! If the buyer places an order and makes payment not through ICTcoder, any issues and disputes have nothing to do with ICTcoder, and ICTcoder will not be responsible for any liabilities!
View details
  • 1. ICTcoder will permanently archive the transaction process between both parties and snapshots of the traded goods to ensure the authenticity, validity, and security of the transaction! 2. ICTcoder cannot guarantee services such as "permanent package updates" and "permanent technical support" after the merchant's commitment. Buyers are advised to identify these services on their own. If necessary, they can contact ICTcoder for assistance; 3. When both website demonstration and image demonstration exist in the source code, and the text descriptions of the website and images are inconsistent, the text description of the image shall prevail as the basis for dispute resolution (excluding special statements or agreements); 4. If there is no statement such as "no legal basis for refund" or similar content, any indication on the product that "once sold, no refunds will be supported" or other similar declarations shall be deemed invalid; 5. Before the buyer places an order and makes payment, the transaction details agreed upon by both parties via WhatsApp or email can also serve as the basis for dispute resolution (in case of any inconsistency between the agreement and the description of the conflict, the agreement shall prevail); 6. Since chat records and email records can serve as the basis for dispute resolution, both parties should only communicate with each other through the contact information left on the system when contacting each other, in order to prevent the other party from denying their own commitments. 7. Although the probability of disputes is low, it is essential to retain important information such as chat records, text messages, and email records, in case a dispute arises, so that ICTcoder can intervene quickly.
View details
  • 1. As a third-party intermediary platform, ICTcoder solely protects transaction security and the rights and interests of both buyers and sellers based on the transaction contract (product description, agreed content before the transaction); 2. For online trading projects not on the ICTcoder platform, any consequences are unrelated to this platform; regardless of the reason why the seller requests an offline transaction, please contact the administrator to report.
View details

Related Source code

ICTcoder Customer Service

24-hour online professional services