Skip to content

rulego/rulego-components

Repository files navigation

rulego-components

Test

English| 简体中文

rulego-components is a rule engine extension component library for RuleGo.

Features

The component library is divided into the following submodules:

Installation

Use the go get command to install rulego-components:

go get github.com/rulego/rulego-components

Usage

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 Reference

Endpoint Component Types

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

External Component Types

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

Filter and Transform Component Types

Component Type Description
Lua Filter x/luaFilter Filter messages using Lua script
Lua Transform x/luaTransform Transform messages using Lua script

Contributing

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.

License

RuleGo is licensed under the Apache 2.0 License - see the [LICENSE] file for details.

About

rulego-components is a rule engine extension component library for RuleGo

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages