English| 简体中文
rulego-components
is a rule engine extension component library for RuleGo.
The component library is divided into the following submodules:
-
endpoint: Receiver endpoint, responsible for listening and receiving data, and then handing it over to the
RuleGo
rule engine for processing.- x/kafka Kafka message subscription endpoint
- x/redis Redis publish/subscribe endpoint
- x/redisStream Redis Stream consumption endpoint
- x/nats NATS message subscription endpoint
- x/rabbitmq RabbitMQ message subscription endpoint
- x/fastHttp FastHTTP server endpoint
- x/websocket WebSocket server endpoint
- x/grpcStream gRPC Stream server endpoint
- x/beanstalkd Beanstalkd task queue endpoint
- x/wukongim WuKongIM message endpoint
-
filter: Filter the messages.
- x/luaFilter Use Lua script to filter messages
-
transform: Transform the messages.
- x/luaTransform Use Lua script to transform messages
-
external: External integration, integrate with third-party systems.
- x/kafkaProducer Kafka producer client
- x/redisClient Redis client
- x/redisPublisher Redis publisher
- x/rabbitmqClient RabbitMQ client
- x/natsClient NATS client
- x/grpcClient gRPC client
- x/restApiCall HTTP/REST API call client
- x/mongodbClient MongoDB client
- x/opengeminiQuery OpenGemini query client
- x/opengeminiWrite OpenGemini write client
- x/beanstalkdTube Beanstalkd tube operations
- x/beanstalkdWorker Beanstalkd worker
- x/wukongimSender WuKongIM message sender
- x/otelClient OpenTelemetry client
-
action: Perform some actions.
- No components implemented yet
-
stats: Perform statistics and analysis on the data.
- No components implemented yet
Use the go get
command to install rulego-components
:
go get github.com/rulego/rulego-components
Use the blank identifier to import the extension component, and the extension component will automatically register to RuleGo
:
// Import Endpoint components
_ "github.com/rulego/rulego-components/endpoint/kafka"
_ "github.com/rulego/rulego-components/endpoint/redis"
_ "github.com/rulego/rulego-components/endpoint/fasthttp"
// Import External components
_ "github.com/rulego/rulego-components/external/redis"
_ "github.com/rulego/rulego-components/external/kafka"
_ "github.com/rulego/rulego-components/external/rabbitmq"
// Import Filter and Transform components
_ "github.com/rulego/rulego-components/filter"
_ "github.com/rulego/rulego-components/transform"
Then use the type specified by the component in the rule chain JSON file to call the extension component:
{
"ruleChain": {
"id": "rule01",
"name": "Test rule chain"
},
"metadata": {
"nodes": [
{
"id": "s1",
"type": "x/redisClient",
"name": "Redis Client",
"debugMode": true,
"configuration": {
"server": "127.0.0.1:6379",
"password": "",
"db": 0,
"cmd": "SET",
"key": "test-key",
"value": "${msg}"
}
},
{
"id": "s2",
"type": "x/luaFilter",
"name": "Lua Filter",
"configuration": {
"script": "return msg.temperature > 20"
}
}
],
"connections": [
{
"fromId": "s1",
"toId": "s2",
"type": "Success"
}
]
}
}
Component | Type | Description |
---|---|---|
Kafka | x/kafka |
Kafka message consumption endpoint |
Redis | x/redis |
Redis publish/subscribe endpoint |
Redis Stream | x/redisStream |
Redis Stream consumption endpoint |
NATS | x/nats |
NATS message subscription endpoint |
RabbitMQ | x/rabbitmq |
RabbitMQ message consumption endpoint |
FastHTTP | x/fastHttp |
HTTP server endpoint |
WebSocket | x/websocket |
WebSocket server endpoint |
gRPC Stream | x/grpcStream |
gRPC stream server endpoint |
Beanstalkd | x/beanstalkd |
Beanstalkd task queue endpoint |
WuKongIM | x/wukongim |
WuKongIM message receiving endpoint |
Component | Type | Description |
---|---|---|
Kafka Producer | x/kafkaProducer |
Send messages to Kafka |
Redis Client | x/redisClient |
Execute Redis commands |
Redis Publisher | x/redisPublisher |
Publish messages to Redis |
RabbitMQ Client | x/rabbitmqClient |
Send messages to RabbitMQ |
NATS Client | x/natsClient |
Send messages to NATS |
gRPC Client | x/grpcClient |
Call gRPC services |
REST API Call | x/restApiCall |
Call HTTP/REST APIs |
MongoDB Client | x/mongodbClient |
MongoDB database operations |
OpenGemini Query | x/opengeminiQuery |
Query OpenGemini time-series database |
OpenGemini Write | x/opengeminiWrite |
Write to OpenGemini time-series database |
Beanstalkd Tube | x/beanstalkdTube |
Beanstalkd tube operations |
Beanstalkd Worker | x/beanstalkdWorker |
Beanstalkd task processing |
WuKongIM Sender | x/wukongimSender |
Send messages to WuKongIM |
OpenTelemetry | x/otelClient |
Send telemetry data to OpenTelemetry |
Component | Type | Description |
---|---|---|
Lua Filter | x/luaFilter |
Filter messages using Lua script |
Lua Transform | x/luaTransform |
Transform messages using Lua script |
The core feature of RuleGo
is componentization, where all business logic is composed of components, and they can be flexibly configured and reused. Currently, RuleGo
has built-in some common components, such as message type Switch, JavaScript Switch, JavaScript Filter, JavaScript Transformer, HTTP Push, MQTT Push, Send Email, Log Record and so on.
However, we know that these components are far from meeting the needs of all users, so we hope to have more developers contribute to RuleGo's extension components, making RuleGo's ecosystem more rich and powerful.
If you are interested in RuleGo and want to contribute to its extension components, you can follow these steps:
- Read RuleGo's documentation, and learn about its architecture, features and usage.
- Fork RuleGo's repository, and clone it to your local machine.
- Refer to RuleGo's examples, and write your own extension component, implementing the corresponding interfaces and methods.
- Test your extension component locally, and make sure it works properly and correctly.
- Submit your code and create a pull request, we will review and merge your contribution as soon as possible.
- Give a star to the RuleGo project on GitHub/Gitee, and let more people know about it.
We welcome and appreciate any form of contribution, whether it is code, documentation, suggestion or feedback. We believe that with your support, RuleGo will become a better rule engine and event processing framework. Thank you!
If the component code you submit has no third-party dependencies or is a general-purpose component, please submit it to the built-in components
under github.com/rulego/rulego, otherwise submit it to this repository: rulego-components.
RuleGo
is licensed under the Apache 2.0 License - see the [LICENSE] file for details.