🍄Notice
The previous chapters described building chains through rule files.
LiteFlow also supports using code to build chains, you don't need to write xml/json/yaml rule files, and ruleSource doesn't need to be defined. Build entirely with code.
In fact, no matter what format the rules of LiteFlow are in, the bottom layer is also constructed by code.
significance
The significance of providing dynamic code constructs has the following two points:
- Some rules are not determined when the project starts. You can build chains through code, or you can replace a chain.
- If you want to store the details of the rules in the database (instead of saving the entire rule file), then dynamic code building is a good choice. It's just that you need to write your own logic to read the database when the application starts, and then use dynamic code to build chains.
LiteFlow has designed a very simple API to build a chain.
And all of this, like the rule file, supports smooth hot refresh. You don't have to worry about the problem of chain disorder caused by changing the chain at high concurrency. For smooth hot refresh, you can refer to Smooth Hot Refresh.
Help us improve this document (opens new window)
last update: 2022/10/13, 00:02:27