【问题标题】:Drool syntax: rule not fire with ',' syntax but works with ' ,' (with an additional space before comma)Drool syntax: rule not fire with \',\' syntax 但适用于 \' ,\' (逗号前有一个额外的空格)
【发布时间】:2022-12-24 06:50:37
【问题描述】:

我遇到了一个奇怪的问题,如果行以 ',' 结尾,流口水规则不会给出异常,但如果逗号 (',') 之前有额外的空格,则会给出异常。有谁知道为什么会这样?数据来自 kafka,我期待一个异常打印输出。这与流口水如何解析参数有关吗?谢谢!下面是两个例子。

//Case 1: not giving anything
when    
App(
        AppId == $inputId,
        source == "APP_STORE"
    )
then 
    System.out.println("Exception Caught!");

//Case 2: Can print out exception
    when    
    App(
            AppId == $inputId ,
            source == "APP_STORE"
        )
    then 
        System.out.println("Exception Caught!");

【问题讨论】:

  • 你在哪里声明$inputId?请显示完整的规则和一个示例输入,它将触发一个版本而不是另一个版本。
  • $inputId 的值可能在末尾有转义字符“\\”。请检查。

标签: drools


【解决方案1】:

只是为了结束对话,不确定这是否是我独有的情况。

但是在逗号前添加一个空格后问题得到解决

AppId == $inputId ,

【讨论】:

    猜你喜欢
    • 2017-03-03
    • 2022-11-30
    • 1970-01-01
    • 1970-01-01
    • 2016-01-11
    • 1970-01-01
    • 2022-12-02
    • 2023-04-08
    • 1970-01-01
    相关资源
    最近更新 更多