📔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