drools。drools_如何调试Drools项目
drools。drools
如何调试Drools项目 (How to Debug a Drools Project)
There are different ways to debug
a drools project.
有多种方法可以debug
drools项目。
In this tutorial we will learn the one which requires writing a Utility class to let you know which rules are being triggered or fired.
在本教程中,我们将学习一种要求编写Utility类以使您知道正在触发或触发哪些规则的方法。
With this approach we can check what all rules are getting triggered in our drools project.
通过这种方法,我们可以检查在drools项目中触发了哪些所有规则。
Here is our Utility Class : Helper.java
这是我们的实用程序类:Helper.java
package com.sample;
import org.drools.spi.KnowledgeHelper;
public class Helper {
public static void help(final KnowledgeHelper drools, final String message) {
System.out.println(message);
System.out.println("\nrule triggered: " + drools.getRule().getName());
}
public static void helper(final KnowledgeHelper drools){
System.out.println("\nrule triggered: " + drools.getRule().getName());
}
}
The first method help
prints the rule triggered along with some extra info which you can pass as String via the drl file.
第一种方法help
打印触发的规则以及一些额外的信息,您可以通过drl文件将它们作为String传递。
The second rule helper
prints whether the particular rule was triggered or not.
第二个规则helper
打印是否触发了特定规则。
翻译自: https://www.studytonight.com/drools/debug-drools-project
drools。drools
上一篇: 开发第一个基于PyQt5的桌面应用
下一篇: 数据库开发三:JDBC数据库开发入门三