Backend Development 10 min read

Introducing Liteflow Rule Engine: Concepts, Usage, and Business Practices

This article presents Liteflow, a lightweight yet powerful rule engine for Java/Spring Boot, explaining its architecture, supported rule formats, component types, configuration, code examples, and a real‑world e‑commerce workflow, while also noting its high‑performance startup processing and monitoring capabilities.

Top Architect
Top Architect
Top Architect
Introducing Liteflow Rule Engine: Concepts, Usage, and Business Practices

In daily development, serial or parallel business processes often lack correlation, and using strategy and template patterns can solve this, but many files become hard to manage. This article introduces the Liteflow rule engine as a global solution.

Liteflow is a lightweight yet powerful rule engine that can be used out‑of‑the‑box to compose complex rules quickly. It supports XML, JSON, YAML rule files and various storage backends such as SQL, Zookeeper, Nacos, Apollo.

Typical architecture diagram (image) shows the engine integrated with Spring Boot, MyBatis‑Plus and Vue/Element front‑end.

Usage starts with obtaining a data context, parsing the rule file, and executing a chain via the FlowExecutor. Each node (component) can be a normal component, a switch component, or an if component, implemented by extending NodeComponent , NodeSwitchComponent , or NodeIfComponent respectively.

Example Maven dependency:

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

Liteflow supports complex flows such as:

# flow rule expression – switch component
SWITCH(a).to(b, c);
# flow rule expression – condition component
IF(x, a, b);

Configuration in application.yml includes rule source path, retry count, execution logging, monitoring, request‑id generator, slot size, thread pool settings, and hot‑deployment options.

Business practice example: after an order is completed, a chain named test_flow executes preparation, score granting, message queue sending, and parallel email and SMS sending.

<flow>
    <chain name="test_flow">
        THEN(prepareTrade, grantScore, sendMq, WHEN(sendEmail, sendPhone));
    </chain>
</flow>

The article concludes that most of Liteflow’s work is done at startup, offering high performance, detailed timing, and statistics, and summarizes the core concepts and usage methods.

BackendJavarule engineWorkflowSpring BootLiteFlow
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.