easy-rules-centraldogma-spring-boot-starter spel 模版格式说明

基于模版格式的代码,看着会比较清晰,所以添加了一个新的配置参数template 可以开启此选项

参考配置

easyrules:
  skipOnFirstAppliedRule: false
  skipOnFirstNonTriggeredRule: false
  priorityThreshold: 1000000
  project: demo
  repo: demo
  contentType: json
  confName: /rules3.json
  template: true
centraldogma:
  hosts:
    - "127.0.0.1:36462"
server:
  port: 9000
 
 

rule 配置说明

需要使用#{} 格式,因为easy rules 默认会讲facts 对象的内容转为map,我们可以使用#进行变量引用,以下是参考配置

[
  {
    "rulesId": "demoapp",
    "rulesContent": [
      {
        "name": "demo",
        "description": "mydemo",
        "priority": 1,
        "compositeRuleType": "UnitRuleGroup",
        "composingRules": [
          {
            "name": "first",
            "description": "first rule",
            "condition": "#{#biz.age>100}",
            "priority": 2,
            "actions": [
              "#{@myService.setInfo(#biz)}" //  @ 引用spring bean  # 引用变量
            ]
          }
        ]
      }
    ]
  }
] 

参考资料

https://docs.spring.io/spring-framework/docs/current/reference/html/core.html#expressions
https://github.com/rongfengliang/easy-rules-centraldogma-spring-boot-starter

posted on   荣锋亮  阅读(132)  评论(0编辑  收藏  举报

编辑推荐:
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· 上周热点回顾(2.17-2.23)
· 如何使用 Uni-app 实现视频聊天(源码,支持安卓、iOS)
· spring官宣接入deepseek,真的太香了~
历史上的今天:
2020-08-22 odyssey prometheus 监控
2020-08-22 odyssey 试用
2019-08-22 singer tap-minio-csv 使用
2019-08-22 Singer 修改tap-s3-csv 支持minio 连接
2018-08-22 streamsets rest api 转换 graphql
2018-08-22 StreamSets sdc rpc 测试
2018-08-22 StreamSets 相关文章

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8
点击右上角即可分享
微信分享提示