Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在不同的规则流中使用一些流口水规则。由于 Drools 规则一次只支持一个规则流组名称,并且规则流业务规则任务也可以映射到单个规则流组,因此我无法在不同的规则流中使用相同的规则。有没有其他方法可以用来过滤规则?喜欢使用标签或元数据?
您可以创建自己的规则组。您创建一个类 OwnRuleGroup,其中包含 String 组作为字段。然后,当您触发规则时,您会创建自己的规则组的实例:
OwnRuleGroup myGroup = new OwnRuleGroup(); myGroup.group = "foo";
并将其插入与其他事实的会话中。在每条规则中,您都可以指定要触发的组。
rule "This will fire for groups foo,bar" when OwnRuleGroup(group in ["foo", "bar"])