JBoss Drools 插入来自 DRL 的事实
我需要我的工作内存了解 DRL 中创建的事实,如下所示:
rule "Your First Rule"
when
$testRule : TestRule(count >= 100)
then
System.out.println("100 PACKETS");
end
有没有办法让工作内存了解 TestRule 事实,然后能够更新?我的目标是让规则知道何时收到 100 个数据包。
I need my WorkingMemory to be aware of facts which are created in the DRL as follows:
rule "Your First Rule"
when
$testRule : TestRule(count >= 100)
then
System.out.println("100 PACKETS");
end
Is there a way of getting the WorkingMemory to become aware of the TestRule fact and then be able to be updated? My objective is to get the rule to know when 100 packets have been received.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常我会创建一些东西作为规则的一部分并将其用作标志。如果你不需要创建任何东西,那么你可以创建一个标志,例如
我不认为这段代码是正确的,但我认为你可以明白这个想法......并且你需要创建一个名为旗帜。需要更新来告诉 drools 必须更新 rete 树。
usually I create something as part of a rule and use it as a flag. If you don't need to create anything, then you can create a flag, for example
I don't think this code is correct, but I think you can get the idea... And you'll need to create a class called Flag. The update is needed to tell drools that is has to update the rete tree.