Introduction to Liteflow Rule Engine: Architecture, Components, Configuration, and Business Use Cases
This article introduces the Liteflow rule engine, detailing its architecture, component types, Maven and YAML configuration, example XML rule definitions, and a real‑world e‑commerce workflow, while also promoting related AI tools and services.
In daily development, serial and parallel business processes often need coordination without direct correlation; using a rule engine like Liteflow can address this need efficiently.
Liteflow is a lightweight yet powerful rule engine that can be used out‑of‑the‑box with Spring Boot, MyBatis Plus, Vue & Element, supporting multiple rule file formats (XML, JSON, YAML) and storage options such as SQL, Zookeeper, Nacos, or Apollo.
<dependency> <groupId>com.yomahub</groupId> <artifactId>liteflow-spring-boot-starter</artifactId> <version>2.10.6</version> </dependency>
Liteflow’s architecture consists of a flow executor, data context for parameter passing, and node components. Node types include ordinary components (implementing NodeComponent ), switch components (extending NodeSwitchComponent ), and conditional components (extending NodeIfComponent ), each supporting custom business logic and error handling.
Configuration is performed via YAML, for example:
liteflow: ruleSource: liteflow/*.el.xml retry-count: 0 print-execution-log: true monitor: enable-log: true period: 300000 request-id-generator-class: com.platform.orderserver.config.AppRequestIdGenerator slot-size: 10240 main-executor-works: 64 when-max-wait-seconds: 15 when-max-workers: 16 when-queue-limit: 5120 parse-on-start: true enable: true
Example XML rule files illustrate serial composition ( THEN(a, b, c) ), parallel composition ( WHEN(a, b, c) ), switch logic ( SWITCH(a).to(b, c) ), and conditional execution ( THEN(IF(x, a), b) ).
A practical e‑commerce scenario demonstrates a flow where, after an order is completed, points are granted, a message is sent, and email and SMS notifications are dispatched in parallel, showcasing Liteflow’s ability to orchestrate complex business processes.
The article also contains promotional sections advertising AI products, paid courses, community groups, and related services, encouraging readers to join and purchase these offerings.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.