Rule Chain Overview
Rule chain is the core concept of RuleGo, it is a directed acyclic graph composed of multiple rule nodes, each rule node is a component that implements a specific business logic, and nodes are connected by relationship types (relation type). Rule chains can be dynamically configured and modified, support nesting and orchestration, and implement complex business processes. Rule chains mainly contain the following concepts:
- Rule chain: It is a logical combination of rule nodes and their relationships, which defines a complete business process. Rule chains can receive messages from different data sources, and send messages to the next or multiple connected rule nodes according to the type and configuration of the rule nodes. Rule chains can be nested and orchestrated to achieve complex and flexible business logic.
- Message: The input and output data or events of the rule chain. It can be transformed, filtered and distributed by the node components. Contains the content, metadata and type of the message. The content of the message can be any data. The metadata of the message can contain some additional information, such as the basic information of the target, etc. The type of the message can be used to distinguish different event types.
- Rule node: The basic component of the rule chain, it is a function that implements a specific business logic. Rule nodes can filter, convert, enrich or perform some actions on the incoming messages. Rule nodes can adjust their behavior and output by configuring parameters.
- Relation Type: The relationship type of the connection between nodes, which determines the path selection of data in the rule chain. Different components provide different path connection relationships, generally speaking:
- The relationships provided by filter-type components are: True/False/Failure;
- The relationships provided by action-type components are: Success/Failure;
- Routing-type components can dynamically control routing or implement more complex relationship routing based on msgType, such as: script routing, msgType routing, etc.
# RuleGo rule chain advantages
Compared with traditional rule engines, RuleGo adopts a new rule engine mode, which is a component-based rule engine based on rule chain orchestration. It has the following characteristics:
- Simplicity: Use JSON to configure the rule chain, no need to use any special rule language or DSL, just use common data structures and syntax, you can easily define and modify the rule chain.
- Efficiency: Use a directed acyclic graph to represent the rule chain, each input message only needs to be processed along the path in the graph, no need to match all the rules, which greatly improves the efficiency and speed of message processing, and also saves resources and time.
- Flexibility: Support dynamic configuration and modification of rule chains, without restarting the application or reloading the rules, you can update and apply the rule chains in real time, which is very suitable for rapid change and iteration of business.
# Rule chain supported running modes
- Serial mode
- Parallel mode
- Parallel + serial mode (nested sub-rule chain mode)
- Mixed mode
- Nested sub-rule chain mode
- Sub-rule chain multi-layer nesting mode
Edit this page on GitHub (opens new window)
Last Updated: 2024/10/23, 10:13:01