LiteFlow LiteFlow
💒Home
📚Documents
💖Donation
🚀Plugin
  • About LiteFlow
  • Update Record
Community
Users
Gitee (opens new window)
Github (opens new window)
  • 简体中文 (opens new window)
  • English (opens new window)
💒Home
📚Documents
💖Donation
🚀Plugin
  • About LiteFlow
  • Update Record
Community
Users
Gitee (opens new window)
Github (opens new window)
  • 简体中文 (opens new window)
  • English (opens new window)
  • 🍤Introduction
  • 🍓Features
  • 🍟Quick Start(Hello world)

    • 🍄Notice
    • 🌿Springboot environment

      • 🧬Dependency
      • ⚙️Config
      • 🛫Execute
    • 🌱Spring environment

      • 🧬Dependency
      • ⚙️Config
      • 🛫Execute
    • 🌵Other environment

      • 🍄Notice
      • 🧬Dependency
      • ⚙️Config
      • 🛫Execute
  • 🍢Configuration item

    • 🍄Notice
    • 🌿Springboot environment
    • 🌱Spring environment
    • 🌵Other environment
  • 🗂Rules file

    • 📔Rules file format
      • The part of the rule
    • 📕Local rule file
    • 📗Zookeeper source
    • 📘SQL database source
    • 📋Nacos source
    • 🗄Etcd source
    • 📙Custom source
  • 🔗General components

    • 📎Common component
    • ✂️Switch component
    • 📌If component
    • 🧬For component
    • ⛓While component
    • 🧿Break component
  • 🧩How to write EL rules

    • 🍄Notice
    • 🌴Serial mode
    • 🎋Parallel mode
    • 🌾Switch mode
    • 🌵If mode
    • 🌳Loop mode
    • 🍁Use sub chain
    • 🍂Use sub variables
    • 💐Complex example
    • 🌻About semicolons
    • 🌰About comments
    • 🐚Component Name Package
  • 🌮Data context

    • 🍄Notice
    • 🌯Definition and use
    • 🪶Pass initialized context
  • 🛩Flow executor

    • 🍄Notice
    • 🎡Executor method
    • 🎢Chain input parameter
    • 🎈LiteflowResponse object
  • 🍋Script component

    • 🍫Choose a script language
    • 🍕Define script component
    • 🌯Define file script
    • 🍣Interact with java
    • 🍘Dynamic refresh script
  • 🍇Declarative component

    • 🥭What is a declarative component
    • 🧅Class level declaration
    • 🥥Method level declaration
  • 🎲Dynamic rules

    • 🍄Notice
    • 🎯How to build
  • 🎨Advanced features

    • 🍒Pre & Finally components
    • 🥠Substitute component
    • 🍉Component Parameters
    • 🍑Component alias
    • 🍍Component tag
    • 🥝Component event
    • 🥑Implicit chain
    • 🍕Private delivery
    • 🍣Component retry
    • 🍖Smooth hot refresh
    • 🍪Component aspect
    • 🍡Step information
    • 🧊Exceptions
    • 🧇Printing details
    • 🧁Custom request id
    • 🌭Multiple type rules
    • 🥗Asynchronous thread pool
    • 🍿Custom component executor
    • 🍥Simple monitor
    • 🧉DTD in Xml
  • ⛱Test cases and demo

    • 🪁Test cases
    • 🪀Demo
  • 🪂Performance
  • v2.9.X文档
  • 🗂Rules file
铂赛东
2022-06-04
Contents

📔Rules file format

LiteFlow supports 3 configuration types

  • xml
  • json
  • yml

json, yml, and xml are all configured similarly and will not increase your extra learning burden. Only the form is different.

tip

In the following chapters, the examples are basically performed in xml configuration. If you want to change to json and yml, you can refer to the configuration template given in this chapter.

# The part of the rule

LiteFlow's rule files are very lightweight and easy to use. Mainly consists of Node and Chain.

tip

It must be noted that Node is not necessary in the Springboot/Spring environment system, as long as the corresponding component is registered in the context. Of course, if configured in the rules file, the framework will also register the node with the Spring context.

In non-Spring environments, Node is required. If Node is not configured, the system will report an error that the node cannot be found. Be sure to pay attention to this.

The following format is only used as a template for users' reference.

    XML configuration example in three modes

    The configuration of rule-source in xml form is as follows:

    Local file:liteflow.rule-source=config/flow.el.xml

    Custom configuration source:liteflow.rule-source=el_xml:com.yomahub.liteflow.test.TestCustomParser

    <?xml version="1.0" encoding="UTF-8"?>
    <flow>
        <nodes>
            <node id="a" class="com.yomahub.liteflow.test.parser.cmp.ACmp"/>
            <node id="b" class="com.yomahub.liteflow.test.parser.cmp.BCmp"/>
            <node id="c" class="com.yomahub.liteflow.test.parser.cmp.CCmp"/>
            <node id="d" class="com.yomahub.liteflow.test.parser.cmp.DCmp"/>
        </nodes>
    
        <chain name="chain1">
            THEN(
                a, b, WHEN(c,d)
            );
        </chain>
    </flow>
    

    JSON configuration example in three modes

    The configuration of rule-source in json form is as follows:

    Local file:liteflow.rule-source=config/flow.el.json

    Custom configuration source:liteflow.rule-source=el_json:com.yomahub.liteflow.test.TestCustomParser

    {
      "flow": {
        "nodes": {
          "node": [
            {
              "id": "a",
              "class": "com.yomahub.liteflow.test.parser.cmp.ACmp"
            },
            {
              "id": "b",
              "class": "com.yomahub.liteflow.test.parser.cmp.BCmp"
            },
            {
              "id": "c",
              "class": "com.yomahub.liteflow.test.parser.cmp.CCmp"
            },
            {
              "id": "d",
              "class": "com.yomahub.liteflow.test.parser.cmp.DCmp"
            }
          ]
        },
        "chain": [
          {
            "name": "chain1",
            "value": "THEN(a, b, WHEN(c, d))"
          }
        ]
      }
    }
    

    YAML configuration example in three modes

    The configuration of rule-source in yaml form is as follows:

    Local file:liteflow.rule-source=config/flow.el.yml

    Custom configuration source:liteflow.rule-source=el_yml:com.yomahub.liteflow.test.TestCustomParser

    flow:
      nodes:
        node:
          - id: a
            class: com.yomahub.liteflow.test.parser.cmp.ACmp
          - id: b
            class: com.yomahub.liteflow.test.parser.cmp.BCmp
          - id: c
            class: com.yomahub.liteflow.test.parser.cmp.CCmp
          - id: d
            class: com.yomahub.liteflow.test.parser.cmp.DCmp
      chain:
        - name: chain1
          value: "THEN(a, b, WHEN(c, d))"
    
    // Make sure to add code blocks to your code group
    Help us improve this document (opens new window)
    last update: 2022/10/13, 00:02:27
    🌵Other environment
    📕Local rule file

    ← 🌵Other environment 📕Local rule file→

    Theme by Vdoing | Copyright © 2020-2022 铂赛东 | MIT License
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式