Extension Components Overview
RuleGo provides not only standard components, but also an extended component library rulego-components
, project address: Github (opens new window) | Gitee (opens new window).
If you need to use extended components, you need to manually import them separately. In addition, using RuleGo ecosystem or third-party provided components is also the same way to import.
# Usage
- Use the
go get
command to installrulego-components
or other third-party components:
go get github.com/rulego/rulego-components@main
- Use a blank symbol to import the corresponding component to complete the registration, for example:
import (
_ "github.com/rulego/rulego-components/external/redis"
)
2
3
- Then in the rule chain, use the component by configuring
type
andconfiguration
:
{
"id": "s5",
"type": "x/redisClient",
"name": "Save to redis",
"debugMode": true,
"configuration": {
"cmd": "SET",
"params": ["${key}", "${msg.data}"],
"poolSize": 10,
"Server": "192.168.1.1:6379"
}
}
2
3
4
5
6
7
8
9
10
11
12
# Contribute components
One of RuleGo's core features is componentization, where all business logic is components and can be flexibly configured and reused. RuleGo has already built-in a lot of common components. However, we know that these components are far from meeting the needs of all users, so we hope that more developers can contribute extended components to RuleGo, making RuleGo's ecosystem more rich and powerful.
If your submitted component code has no third-party dependencies or is a general-purpose component, please submit it to the main library under the standard component components (opens new window) , otherwise submit it to the extended component repository: rulego-components (opens new window) .