All Projects → JaryZhen → rulegin

JaryZhen / rulegin

Licence: other
基于JavaScript Engine的轻量级规则引擎系统,重构于开源IOT项目thingboard

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to rulegin

esa-httpclient
An asynchronous event-driven HTTP client based on netty.
Stars: ✭ 82 (-18%)
Mutual labels:  netty
freeswitch-esl-all
freeswitch event socket base on netty 4 and has some new features.
Stars: ✭ 110 (+10%)
Mutual labels:  netty
toy-rpc
Java基于Netty,Protostuff和Zookeeper实现分布式RPC框架
Stars: ✭ 55 (-45%)
Mutual labels:  netty
grpc-web-chat
A simple project demonstrating how both a Go and Java back end can power the same Vue.js front end using gRPC.
Stars: ✭ 21 (-79%)
Mutual labels:  grpc-java
small-rpc
🔥基于netty和hessian的一个轻量级RPC调用框架
Stars: ✭ 21 (-79%)
Mutual labels:  netty
styx
Programmable, asynchronous, event-based reverse proxy for JVM.
Stars: ✭ 250 (+150%)
Mutual labels:  netty
eagle
Eagle分布式rpc调用,借助Zookeeper实现服务注册和发现,基于AQS实现高性能连接池,支持分布式追踪、监控、过载保护等配置。提供Spring和SpringBoot插件,方便与Spring和SpringBoot集成。
Stars: ✭ 77 (-23%)
Mutual labels:  netty
dsip
通过netty网络框架,编解码sip消息。 以及国标gb28181的部分功能, 不依赖spring,方便集成
Stars: ✭ 19 (-81%)
Mutual labels:  netty
websocket-scala-client
WebSocket client based on Netty
Stars: ✭ 37 (-63%)
Mutual labels:  netty
hrpc
A simple Java RPC framework based on Spring, Netty, Protobuf and Consul
Stars: ✭ 34 (-66%)
Mutual labels:  netty
message-pipe
基于Redis客户端Redisson实现负载均衡的分布式消息顺序管道
Stars: ✭ 21 (-79%)
Mutual labels:  grpc-java
complete-gRPC
In this course, we are going to learn about gRPC and how to use it with protocol buffer
Stars: ✭ 53 (-47%)
Mutual labels:  grpc-java
http-benchmark-netty
基于Java Netty的HTTP客户端工具 & HTTP高性能测试工具。参数灵活定制、支持邮件报表等。Python Tornado版: https://github.com/junneyang/http-benchmark-tornado 。
Stars: ✭ 41 (-59%)
Mutual labels:  netty
acteur
A framework for writing lightweight, scalable servers with Guice and Netty
Stars: ✭ 66 (-34%)
Mutual labels:  netty
rpc-spring-boot-starter
自定义rpc框架,支持Java序列化和protobuf序列化协议,多种负载均衡算法
Stars: ✭ 75 (-25%)
Mutual labels:  netty
reverie
An efficient and generalized implementation of the IKOS-style KKW proof system (https://eprint.iacr.org/2018/475) for arbitrary rings.
Stars: ✭ 51 (-49%)
Mutual labels:  zk
xmutca-rpc
Xmutca-rpc是一个基于netty开发的分布式服务框架,提供稳定高性能的RPC远程服务调用功能,支持注册中心,服务治理,负载均衡等特性,开箱即用。
Stars: ✭ 18 (-82%)
Mutual labels:  netty
JavaHub
Java程序员学习之路,持续更新原创内容,欢迎Star
Stars: ✭ 27 (-73%)
Mutual labels:  netty
java-grpc
OpenTracing Instrumentation for gRPC
Stars: ✭ 52 (-48%)
Mutual labels:  grpc-java
spring-boot-learn-box
spring boot集成其他组件
Stars: ✭ 21 (-79%)
Mutual labels:  netty

一、背景

规则引擎是一种根据规则中包含的指定条件,判断其能否匹配运行时刻的实时条件来执行规则中所规定的动作,
用户可通过规则引擎设定消息处理规则,
对指定的消息采取相应的措施来对设备进行监控和处理,如发送警告信息;
也可以将设备消息转发, 或者过滤到其他部件。

1.1 基本概念

	1)规则
	规则包含一个条件过滤器和多个动作。一个条件过滤器可以包含多个过滤条件。条件过滤器是多个布尔表达式的组合,其组合结果仍然是一个布尔类型的。
	在程序运行时,动作将会在条件过滤器值为真的情况下执行。
	2)动作
	动作是一段可执性的代码。
	3)消息队列
	消息队列是规则应用的主体, 消息队列中包含的消息具有各种属性。 这些属性出现在规则过滤条件中, 用于判断某条消息是否满足条件。 

1.2 典型的应用场景包括:

 1.实时告警异常的数据;
 2.计算一天内的温度最大最小和均值等;
 3.将满足某条件的的数据转存以便查询;
 4.过滤异常数据等。

二、架构

2.1 逻辑模块:

哈哈

2.2 实现架构:

哈哈

三、 规则描述

3.1 规则BNFC

Rule :=  if Conditions then Actions

Conditions := Conditions and Condition |
              Conditions or Condition | 
			  Condition

Condition :=  Key Operator Value
	Key := Key name string | 
           Function(Key name string)

   Function(Key name string) : = Window Function 
   WindowFunction := (day|hour| minute|second) (key, (min|max|mean|var))

Operator:= Basic Operator | Advanced Operator

Basic  Operator:=   > | < | = | >= | <= |<> 
Advanced Operator := ℗ |SelfDef

Value: = Static value | Key |Function| Expression(key) | Model 

Actions:= Alarm | Filter | SelfDef

3.2 规则约束

1.℗只能跟Model名
2.Expression(key) 中只能有1个Key, 其他参数都是常量
3.SelfDef action是可执性的代码段(java, Scala, python)

四、Rule Engine Demo说明

  • 规则定义详细定义

  • Step 1: Rule 定义

      {
        "name": "in-press-alarm",
        "weight": 0,
        "dataSource": {
          "type": "kafka",
      	"configuration": {
      		"topic": "Suct_Data",
      		"format": "null",
              "keys": [
               "Suct_Pres_Status"
              ]
          }
        },
        "filters": [
          {
            "name": "吸气压力状态",
            "type": "kafkaWindow",
      	  "configuration": {
      	  "size":2000,
      	  "step":1000
      	  },
            "condition": "Sum(Suct_Pres_Status) > 70"
          }
        ],
        "actions": [
          {
            "type": "Print",
            "template": "吸气温度高"
          }
        ]
      }
    
  • Step 2: Rule注册

      curl -X POST -H 'Content-Type: application/json' -d @Rule.json @localhost:8080/api/rule
    
  • Step 3: Rule 启动

      首先Kafka 发送数据到Topic Suct_Data
      curl -X POST @localhost:8080/api/rule/ID/activate
    
  • Step 4. 结果查验

      通过控制台来查看运行结果
    
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].