我们正在开发一个监控应用程序,在该应用程序中,我们跟踪一组应用程序中任务的处理。我们有一套符合我们需求的drools规则,但是我们有一些性能问题(我们可能很容易在会话中拥有多达50k个对象)。我们正在寻找最佳的Pactex
这个问题是关于bloolean标志的使用。我们正在努力删除大部分org. drools.core.rule.限制。MvelConstraint:异常jting:…
警告。
我们经常在布尔标志上发出这样的警告。
例如在:
rule "PropagateDeprecation"
when
$parent:BaseChainStep( $parent.Deprecated )
$child:BaseChainStep( $parent.Id == $child.Parent, !$child.Deprecated )
then
modify($child){
setDeprecated(true)
}
end
我们已经警告了$家长。弃用和!$child。弃用。
我们想了解为什么布尔标志上有这样的警告。
我们还想知道警告对组合条件的影响。例如:
rule "App1_TriggerExpected"
when $chainStep:App1ChainStep(
HasChain
, HasParent
, !$chainStep.Deprecated
, Status in ("error", "closed")
, Places != null
, Analysis != null)
then
..
end
如果我们在第一个条件HasChain
上有警告,如何解决时子句?是否也评估其他条件(对所有App1ChainStep对象进行迭代)或仍然使用一些“索引”来提供帮助?
如果有关系,我们使用标志作为布尔值(而不是布尔值)来确保默认值为假值。
编辑:
问题可能与扩展类有关。在我们的用例中,我们有如下内容:
declare BaseChainStep
parent : GUID
deprecated : boolean
end
declare App1ChainStep extends BaseChainStep
// specific App1 fields
end
BaseChainStep字段可以在规则中使用App1ChainStep对象或BaseChainStep对象进行操作。
rule "deprecateApp1"
when $app1:App1ChainStep( BusinessLogicCondition )
then
modify($app1) {
setDeprecated(true)
}
end
然后使用“ProploateDeprecation”规则将弃用标志传播给App1子级。
导致警告的布尔标志在BaseChainStep类中声明。
尽管您偏离了访问属性的常规方式,但这不应该触发您报告的警告。我无法使用6.3.0重现此问题。您应该添加(a)Drools版本(b)类BaseChainStep的Java代码,可以使用如图所示的规则重现问题。
这是另一种(简单得多)编写结合布尔属性的规则的方法:
rule bool1
when
X( big, fast )
then
System.out.println( "big fast X" );
end
您甚至可以使用布尔运算符:
rule bool2
when
X( big && ! fast )
then
System.out.println( "big slow X" );
end
请注意字段名的简单使用,假设使用常规命名,例如,字段为大
,访问器为isBig
和setBig
。