All Projects → Hale-Lee → Ruleengine

Hale-Lee / Ruleengine

Licence: apache-2.0
最好使用的规则引擎之一,可以直接使用SQL语句定义规则,简化了编码的负荷,也可以使用XML, drl文件配置规则,还支持drools文件导入。One of the best rule engines, is easy to use SQL statements to define rules, simplify the workload of coding, it also can use XML, DRL file to configure rules, and support import drools file directly.

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to Ruleengine

D3D12Renderer
Custom renderer and physics engine written from scratch in C++/Direct3D 12.
Stars: ✭ 17 (-93.73%)
Mutual labels:  engine
IwEngine
This is an engine that I initially started building after taking a game coding class in high school. I didn't like Unity so tried to make something more code focused that was personally easier to use.
Stars: ✭ 97 (-64.21%)
Mutual labels:  engine
KDBG
The windows kernel debugger consists of two parts, KMOD which is the kernel driver handling ring3 request and KCLI; the command line interface for the driver. It originated due to insufficient useability with CheatEngine's DBVM driver while debugging games running under certain AntiCheat software.
Stars: ✭ 28 (-89.67%)
Mutual labels:  engine
Pygin
Simple game engine produced for making easier to build more complex games using Python.
Stars: ✭ 21 (-92.25%)
Mutual labels:  engine
meta2d
Meta2D is open source WebGL 2D game engine for making cross platform games.
Stars: ✭ 33 (-87.82%)
Mutual labels:  engine
that game engine
Source code for a game engine development series
Stars: ✭ 47 (-82.66%)
Mutual labels:  engine
evael
Simple 2D/3D game engine written in the D programming language.
Stars: ✭ 17 (-93.73%)
Mutual labels:  engine
Ggez
Rust library to create a Good Game Easily
Stars: ✭ 3,120 (+1051.29%)
Mutual labels:  engine
RendererEngine
2D - 3D Renderer Engine builds with OpenGL, SDL2, C++
Stars: ✭ 17 (-93.73%)
Mutual labels:  engine
CLUSEK-RT
Vulkan based C++ ray-tracing game engine.
Stars: ✭ 24 (-91.14%)
Mutual labels:  engine
v-oogle
Google.com, reVued. 🔎
Stars: ✭ 40 (-85.24%)
Mutual labels:  engine
elasty
A research-oriented elastic body simulator
Stars: ✭ 173 (-36.16%)
Mutual labels:  engine
SFE-Engine
A real time renderer based on Vulkan(LWJGL).
Stars: ✭ 20 (-92.62%)
Mutual labels:  engine
ludum
My entry for Ludum Dare 35
Stars: ✭ 13 (-95.2%)
Mutual labels:  engine
PokemonBattleEngine
A C# library that can emulate Pokémon battles.
Stars: ✭ 92 (-66.05%)
Mutual labels:  engine
Yggdrasil-Legacy
Experimental Vulkan Renderer / Game Engine written in C++20.
Stars: ✭ 20 (-92.62%)
Mutual labels:  engine
Dot-World-Maker
Online web role playing game (RPG) engine let you build your own game directly from your browser.
Stars: ✭ 25 (-90.77%)
Mutual labels:  engine
Drools
rules engine
Stars: ✭ 266 (-1.85%)
Mutual labels:  engine
Tinyengine
Tiny OpenGL Wrapper / 3D Engine in C++
Stars: ✭ 251 (-7.38%)
Mutual labels:  engine
3D-Engine-OpenGL-4
3D Graphics Engine For Games | C++ OpenGL 4.1
Stars: ✭ 19 (-92.99%)
Mutual labels:  engine

RuleEngine

one of the best simple rule engine, easy to use, can define different format of the rule, such as xml, drools, database.

###使用方法

#1, 在POM.XML文件中添加下面的内容.

    <dependency>
        <groupId>com.github.hale-lee</groupId>
        <artifactId>RuleEngine</artifactId>
        <version>0.2.0</version>
    </dependency>

#2, 配置ruleEngine.properties文件

rule.reader=xml/drools/database

  -2.1 若选择xml格式的规则文件,那么rule.reader=xml,此时需要设置xml.rule.filename=ruleconfig.xml    
  -2.2 若选择将规则文件定义存放在数据库中,那么设置rule.reader=database,此时需要设置db.rule.table=表名  (存放规则定义的表格,其格式可以参考SQL文件夹下的rule-mysql.sql或rule-oracle.sql)同时需要配置或者引用现有框架的jdbc配置, RuleEngine支持直接的jdbc数据库,也支持druid的数据库连接池,还可以直接引用外部框架的的数据库链接,比如spring-mvc的数据库链接。      
  -2.3 若选择使用drools格式的规则文件,则设置rule.reader=drools,同时需要设置drools.rule.filename=sample.drl

#3,引用调用

  直接import EngineService类,生成EngineService对象,同时将需要校验的bean作为Object传入给EngineService对象的Start方法。   如下所示:

	EngineService service = new EngineService();

	try {

		Student st = new Student();
		st.setAge(5);
		st.name = "tom";
		st.sex = 1;

		EngineRunResult result = service.start(st);
		System.out.println(result.getResult().getName());

		System.out.println(st.getAge());
	} catch (RuleEngineException e) {

		e.printStackTrace();
	}

    #4,编写规则      

       -4.1 若2.1选择了xml格式的规则,则需要配置xml.rule.filename项目,这个地方填写规则的文件名,需要指定为xml文件格式。 典型的规则项目为:

<rule id="totallist" exe_class="" method="" parent="">
    <property name="content" value="客户身份证号码规则"/>
    <property name="result" value="RESULT.REJECTED" desc="拒绝"/>
    <property name="continue_flag" value="1"/>
    <property name="group_express" value="(blacklist || graylist)"/>
	<property name="priority" value="00010"/>
</rule>

       -4.2 若2.2选择了drools格式的规则,则需要配置drools.rule.filename项目,这个地方填写规则的文件名,需要指定为drl文件格式。 典型的规则项目为:      

rule "ageUp12"
 salience 400
 when
	$student: Student(age < 8)
	 /* antoher rule */
 then
	System.out.println("I was called, my name is : " + $student.name);
	ageUp($student,12);
	//callOver($student);
 end

 
      -4.3 若2.3选择database格式的规则,则需要配置db.rule.table项目,这个地方填写规则的数据库表结构,其表生成的结构可以参考SQL目录下的2个文件。典型 的规则描述如下:  

	item_no|content|exe_sql|exe_class|param_name|param_type|comparison_code|comparison_value|baseline|result|executor|priority|continue_flag|parent_item_no|group_express|remark|comments|enable_flag|create_time|update_time
   11|黑名单|select count(1) as cnt from tl_blacklist where customer_no = ? and delete_flag = 1|customer_no|java.lang.String|01|==|0|PASSED|100|1|1|2018-02-26 12:40:15.000000|2018-02-26 12:40:18.000000

     数据库连接方式时,需要同时设置db.accesser,如果是直接使用druid的数据库连接池,可以设置成db.accesser=tech.kiwa.engine.utility.DirectDBAccesser,DirectDBAccesser提供了开关变量UseDruid,如果设置成true就是使用了druid连接池,如果设置成false则是直接地jdbc。
     如果使用Spring的数据库连接,可以设置成db.accesser=tech.kiwa.engine.utility.SpringDBAccesser.

https://github.com/Hale-Lee/RuleEngine/wiki

微信: tianyaguoke2000

加微信请注明:规则引擎

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].