🗄Etcd source
Starting from v2.9.0, LiteFlow supports Etcd' rule configuration source.
# Dependency
<dependency>
<groupId>com.yomahub</groupId>
<artifactId>liteflow-rule-etcd</artifactId>
<version>2.9.3</version>
</dependency>
# Configuration
You don't need to configure the liteflow.ruleSource
path anymore.
Just configure the extra parameters of the plugin:
liteflow:
rule-source-ext-data-map:
endpoints: http://127.0.0.1:2379
chainPath: /liteflow/chain
scriptPath: /liteflow/script
liteflow.rule-source-ext-data={\
"endpoints":"http://127.0.0.1:2379",\
"chainPath":"/liteflow/chain",\
"scriptPath":"/liteflow/script"\
}
// Make sure to add code blocks to your code group
# Configuration instructions
Configuration Item | Description |
---|---|
endpoints | The connection string of zk, which can be a cluster |
chainPath | Your rule directory node (there will be many rules below, one node per rule) |
scriptPath | Your script directory node (there will be many scripts below, one node per script) |
# Description of stored data
In etcd, suppose your chainPath
is: /liteflow/chain
Then each node under this path is a rule, the key of the node is chainId, and the value is simple EL (THEN(a,b,c)
), for example:
/liteflow/chain
---chain1
---chain2
For the script path, suppose your scriptPath
is: /liteflow/script
Then each node under this path is a script component. The key of the node has a fixed format: script component ID:script type:script name
, and the value is the script data, for example:
/liteflow/script
---s1:script:script component s1
---s2:script:script component s2
About the script type, you can refer to the section Defining Script Components.
# Auto Refresh
Using this Etcd configuration source plug-in, any rule changes in the Etcd node will be automatically pushed to the business system for real-time refresh. You don't need to do anything.
# Example
In order to make it easy for everyone to get started with the configuration of the Etcd rule, here is a small demo that you can pull to run locally, you need to replace the Etcd configuration information.
Before running the project, read the readme.txt
file in the project.
https://github.com/bryan31/liteflow-ext-rule-demo