我想设置规则以拥有多个规则流组。这样做的原因是我将拥有不同的BPMN流程,这些流程将根据其规则流组采用不同的规则子集。例如,
rule "Test 1" ruleflow-group "A" ruleflow-group "B"
when
// Condition
then
// Action
end
rule "Test 2" ruleflow-group "A"
when
// Condition
then
// Action
end
BPMN Process 1 is linked to ruleflow-group A, so it should run rules Test 1 and Test 2.
BPMN Process 2 is linked to ruleflow-group B, so it should run rule Test 2 only.
当我编写如上所述的规则时,编译器不会抱怨。但是,在运行BPMN Process 1时,它只运行规则Test 2.运行BPMN Process 2时,它只运行规则Test 1.
答案 0 :(得分:1)
Rule
类定义drools source code具有ruleflow-group属性的单个String字段。因此,一个规则不可能有多个规则流组。
public void setRuleFlowGroup(final String ruleFlowGroup) {
this.ruleFlowGroup = ruleFlowGroup;
}
或者,您可以使用控制事实对规则进行分组。
rule 1
when
Controller(group in ("group1", "group2"))
then
...