fast-drools-spring-boot-starter icon indicating copy to clipboard operation
fast-drools-spring-boot-starter copied to clipboard

Easy drools,version 8.0.8

Fast Drools 涓枃

FastDroolsLogo

Build Status LICENSE Language Average time to resolve an issue Percentage of issues still open

Introduction

fast-drools-spring-boot-starter integrates Drools with Springboot providing a more efficient, sophisticated model for rule configuration and management. It is capable of updating rules dynamically with regards to hot deployment.

Contact

Feel free to ask me any questions with the contacts below.

  • QQ group chat锛?76067618
  • Drools video tutorials锛歨ttps://space.bilibili.com/564757

FAQ

  • 1锛塂emo锛?/p>

    • https://github.com/hongwen1993/all/tree/master/java/drools/boot-drools
  • 2锛塛hy I can't dynamically update rules in development environment?

    • In development stage, it is not recommended to use tools such as Intellij IDEA for rule modification. If insisted, Ctrl + F9 or compile manually to apply the changes you make.
  • 3锛?..

Usage

  • 1锛塈nject the following dependency in pom.xml锛?strong>update 2021/01/20锛夛細

    <dependency>
        <groupId>com.github.hongwen1993</groupId>
        <artifactId>fast-drools-spring-boot-starter</artifactId>
        <version>8.0.9</version>
    </dependency>
    
  • 2锛塂esignate path to drools rule file in the configruation file

    # (necessary) specify a rule file folder that will automatically scan all rule files, include  decision tables, and CSV files, 
    # also support classpath resource path, example锛歝lasspath:drools/**/*.drl
    # win system use \\, example C:\\DRL\\
    # linux system use /, example /var/config/
    spring.drools.path = C:\\DRL\\
    # set up mode with options "stream" or "cloud" (default = stream)
    spring.drools.mode = stream
    # close drl file auto update, on or off (default = on)
    spring.drools.auto-update = on
    # regulates update cycle, unit is seconds (default = 30)
    spring.drools.update = 10
    # monitoring rules, on or off (default = on)
    spring.drools.listener = on
    # open drl syntax checker, on or off (default = off)
    spring.drools.verify = off
    # default drl file charset锛坉efault utf-8锛?spring.drools.charset = GBK
    
  • 3锛塈ntroduce KieTemplate with annotation

    @Autowired
    private KieTemplate kieTemplate;
    
  • 4锛塖ession can be acquired with getKieSession(). Supporting multiple rule files at the same time as well as decisions tables.

    KieSession kieSession = kieTemplate.getKieSession("rule1.drl", "rule2.drl");
    ......
    
  • 5锛塕esults

    2020-09-10 16:51:08.344 DEBUG ===>>寮€濮嬫洿鏂拌鍒欐枃浠?2020-09-10 16:51:09.730 DEBUG ===>>鎻掑叆瀵硅薄锛歔fact 0:1:1571707504:1072693248:1:DEFAULT:NON_TRAIT:java.lang.Double:1.0]锛涙搷浣滆鍒欙細null
    2020-09-10 16:51:09.748 DEBUG ===>>鍖归厤鐨勮鍒欙細[Rule name=瑙勫垯1-1, agendaGroup=MAIN, salience=0, no-loop=false]
    2020-09-10 16:51:09.761 DEBUG ===>>寮€濮嬫墽琛孞ava浠g爜鍧楋紝鍖归厤瑙勫垯锛歔Rule name=瑙勫垯1-1, agendaGroup=MAIN, salience=0, no-loop=false]锛岃瘎浼板璞★細[[fact 0:1:1571707504:1072693248:1:DEFAULT:NON_TRAIT:java.lang.Double:1.0]]
    .... 鎵ц杩囩▼蹇界暐 ....
    2020-09-10 16:51:09.765 DEBUG ===>>缁撴潫鎵цJava浠g爜鍧楋紝鍖归厤瑙勫垯锛歔Rule name=瑙勫垯1-1, agendaGroup=MAIN, salience=0, no-loop=false]锛岃瘎浼板璞★細[[fact 0:1:1571707504:1072693248:1:DEFAULT:NON_TRAIT:java.lang.Double:1.0]]
    

锛圞ieTemplate 涓嬪皝瑁呬簡璁稿 Drools 鐨勫姛鑳斤紝璁稿渚挎嵎鐨?API 绛変綘鏉ュ彂鐜帮紒锛?/p>

Available Features

  • [x] Quick start with Drools-Springboot integration without having to go through the complex configuration process in kmodule.xml
  • [x] Specify filenames to perform evaluation rules for more intuitive process analysis.
  • [x] Dynamically loads the rules file
  • [x] Group rule file
  • [x] NIO file mapping for faster file reads and writes
  • [x] Use caching to improve rule evaluation
  • [x] Support for various path formats
  • [x] Supports rule table files in XLS and XLSX formats
  • [x] Logging monitors the dynamics of rules and evaluation objects in the process
  • [ ] Extreme execution speed and performance, and customizable

Features in Progress

  • Rule execution monitoring
  • Distributed based assessment and decision making
  • Rule execution success failure rate statistics
  • GUI control for rule files
  • GUI control for decision tables
  • Storage of distributed rule files

License

Apache 2.0

User List

If you are using fast-drools and think that it helps you or want do some contributions to it, please call me to let us know just for promotional purposes only.

## Stargazers over time

Stargazers over time