Backend Development 8 min read

Introducing LiteFlow: A Lightweight Java Rule Engine for Workflow Orchestration

LiteFlow is a lightweight Java rule engine that lets developers orchestrate serial and parallel business workflows using XML, JSON or YAML rule files stored in back‑ends like SQL or Zookeeper, offering NodeComponent, NodeSwitchComponent and NodeIfComponent types, EL syntax, Spring Boot integration, and high‑performance execution monitoring.

Java Tech Enthusiast
Java Tech Enthusiast
Java Tech Enthusiast
Introducing LiteFlow: A Lightweight Java Rule Engine for Workflow Orchestration

In daily development, serial or parallel business processes often lack correlation, leading to scattered code when using traditional strategy or template patterns.

LiteFlow is a lightweight yet powerful Java rule engine that enables global orchestration of such flows. It supports rule files in XML, JSON or YAML formats and can store them in various back‑ends such as SQL, Zookeeper, Nacos or Apollo.

The engine provides several component types:

NodeComponent : ordinary component that implements process and can control execution via isContinueOnError , isEnd , etc.

NodeSwitchComponent : switch‑like component that overrides processSwitch to choose the next node.

NodeIfComponent : conditional component that overrides processIf and returns a boolean.

Rule files are written in EL syntax. Typical expressions include:

THEN(a, b, c, d);
WHEN(a, b, c);
SWITCH(a).to(b, c);
IF(x, a, b);

A Maven dependency to embed LiteFlow in a Spring Boot project is:

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

Data context objects carry parameters between nodes, allowing each node to read or write the required data.

Typical configuration (application.yml) looks like:

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

In a real e‑commerce scenario, an order‑completion flow can be defined as:

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

The flow executes the preparation, score granting, and message queue steps sequentially, while sending email and SMS in parallel.

LiteFlow parses all rules at startup, registers components, and assembles the execution graph, delivering high performance and detailed timing statistics.

Javarule engineWorkflowSpring BootELLiteFlow
Java Tech Enthusiast
Written by

Java Tech Enthusiast

Sharing computer programming language knowledge, focusing on Java fundamentals, data structures, related tools, Spring Cloud, IntelliJ IDEA... Book giveaways, red‑packet rewards and other perks await!

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.