[Open Source] A Lightweight, High-Performance, Embedded Rule Engine Based on Go

Open SourceProcess Management
2026-06-28 04:22 1 次浏览 • 0 次下载 0KB
[Open Source] A Lightweight, High-Performance, Embedded Rule Engine Based on Go

1. Project Overview

RuleGo is a lightweight, high-performance, embedded rule engine based on Go. It is also a flexible and highly customizable event processing framework. It can filter, transform, enrich, and execute various actions on incoming messages.

2. Open Source License

Licensed under Apache-2.0

3. Screenshots

Rule Chains

A rule chain is a logical group of rule nodes and their relationships. It receives outbound messages from nodes and forwards them to the next one or more nodes through specified relationships. Here are some common rule chain examples:

Sequential Execution:

Asynchronous + Sequential Execution:

Using Sub-Rule Chains:

Some Complex Examples:

4. Feature Overview

RuleGo is a lightweight, high-performance, embedded rule engine based on Go. It is also a flexible and highly customizable event processing framework. It can filter, transform, enrich, and execute various actions on incoming messages.

This project was largely inspired by thingsboard. It references its rule chain concepts but makes significant architectural adjustments to accommodate the following scenarios:

  • Significant optimizations have been made in resource consumption and performance, making it more suitable for edge computing scenarios.
  • Dynamically orchestrate business logic without downtime or recompilation to meet highly customized and rapidly changing business requirements.
  • Non-intrusively embed it into existing projects.
  • Provides more flexible interfaces and callback hooks.
  • A more open component ecosystem. You can use components provided by the community or encapsulate your business logic into components, then quickly implement dynamic business requirements through a building-block approach.

Features

  • Development Language: Go 1.18
  • Lightweight: No external middleware dependencies. Efficiently processes data and enables data interactions even on low-cost devices, making it suitable for IoT edge computing.
  • High Performance: Benefits from Go's high-performance characteristics. RuleGo also uses technologies such as goroutine pools and object pools. Processing 100,000 records through JavaScript script filtering -> JavaScript data processing -> HTTP push takes an average of 9 seconds.
  • Embedded: Supports embedding RuleGo into existing projects and using its features non-intrusively.
  • Component-Based: All business logic is implemented as components that can be flexibly configured and reused.
  • Rule Chains: Flexibly combine and reuse different components to implement highly customized and extensible business workflows.
  • Workflow Orchestration: Supports dynamic orchestration of rule chains. You can encapsulate business logic into RuleGo components and then implement highly variable business requirements through a building-block approach.
  • Easy Extensibility: Provides rich and flexible extension interfaces and hooks, including custom components, component registration and management, rule chain DSL parsers, goroutine pools, rule node message input/output callbacks, and rule chain completion callbacks.
  • Dynamic Loading: Supports dynamically loading components and extensions through Go plugin.
  • Built-in Common Components: Includes components such as message type Switch, JavaScript Switch, JavaScript filter, JavaScript transformer, HTTP push, MQTT push, email sending, and logging. You can also extend it with additional components.
  • Context Isolation Mechanism: Provides a reliable context isolation mechanism, eliminating concerns about data leakage between contexts under high concurrency.

5. Tech Stack

Installation

Install RuleGo using the go get command:


go get github.com/rulego/rulego

Usage

Define rule chain DSL using JSON format:

The following example defines three rule nodes. The rule chain logic is shown in the diagram below (see testcases/ for more examples).

Detailed content, please refer to README.md document.

Performance

RuleGo adds almost no additional system overhead and consumes very few resources. Thanks to its goroutine pools and object pools, its performance can even exceed that of directly calling business logic, making it particularly suitable for running on edge servers.


Machine: Raspberry Pi 2 (900MHz Cortex-A7*4,1GB LPDDR2)
Data Size: 260B
Rule Chain: JavaScript script filtering -> JavaScript complex transformation -> HTTP push
Test Results: At both 100 and 500 concurrent requests, memory usage remained relatively stable at around 19 MB.


#1
资源直链https://gitee.com/rulego/rulego
去下载
星河码客

发现和分享优质开源项目,传承互联网精神,为开发者服务。

关于本站

联系我们

微信/广告合作:ITcloub (备注星河码客)

免责声明:本站资源版权归原作者所有,仅供学习与交流。如有侵权,请通过「关于我们 - 侵权投诉」联系删除。

Powered by Nuxt · Deployed on Cloudflare