📗Zookeeper source
# Dependency
LiteFlow supports placing the configuration in the zk cluster, based on the zk notification mechanism, LiteFlow supports real-time modification of the process
If you need to use zk, you need to add the following additional dependency:
<dependency>
<groupId>com.yomahub</groupId>
<artifactId>liteflow-rule-zk</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={\
"connectStr":"127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183",\
"nodePath":"/liteflow/rule"\
}
liteflow:
rule-source-ext-data-map:
connectStr: 127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183
nodePath: /liteflow/rule
// Make sure to add code blocks to your code group
# Configuration instructions
Configuration Item | Description |
---|---|
connectStr | 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 ZK, 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
Any rule changes in the zk node will be automatically pushed to the business system for real-time smooth hot 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 ZK rule, here is a small demo that you can pull to run locally, you need to replace the ZK configuration information.
Before running the project, read the readme.txt
file in the project.
https://github.com/bryan31/liteflow-ext-rule-demo