Java 8,drools 5.x和drools 7.x [英] Java 8, drools 5.x and drools 7.x

查看:319
本文介绍了Java 8,drools 5.x和drools 7.x的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Drools 5.x(drools-compiler 5.2.1.Final,drools-decisiontables 5.4.0.Final,以及drools-templates 5.4.0.Final; jbpm-flow 5.1.1.Final,jbpm-bmpn2 5.1.1.Final及其各自的依赖关系)我的Java作业,我使用Java 1.7.0_21构建/运行它。我目前的设置正常。我正在使用决策表(电子表格)。



我能够使用drools 5.x使用Java 1.8.0_162构建/运行我的项目,如上所述;但是,当java作业运行时,它会加载决策表(电子表格),但它不启动任何规则,我没有在执行的最后一行中得到异常:



am using Drools 5.x (drools-compiler 5.2.1.Final, drools-decisiontables 5.4.0.Final, and drools-templates 5.4.0.Final; jbpm-flow 5.1.1.Final, jbpm-bmpn2 5.1.1.Final and with their respective dependencies) for my Java job, I build/run it with Java 1.7.0_21. My current set up works properly. I am using a decision table (spreadsheet).

I am able to build/run my project with Java 1.8.0_162 using drools 5.x as described above; however, when the java job runs it loads the decision table (spreadsheet) but it does not fire up any of the rules, I am not getting an exception in the last line that gets executed:

Properties props = new Properties();
    
    KnowledgeBuilderConfiguration configuration = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(props);
    
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newDecisionTableConfiguration(configuration);
    
    DecisionTableConfiguration config = KnowledgeBuilderFactory.newDecisionTableConfiguration();
    
    config.setInputType(DecisionTableInputType.XLS);
    
    kbuilder.add(ResourceFactory.newClassPathResource(spreadsheetFile), ResourcType.DTABLE, config);  // last line executed and then job exists and completes successfully.



在最后一行执行之前我放了一些调试日志,它们显示如下:




Prior to the last line getting executed I put some debug logs and they show the following:

>> Properties (props):  {}

>> KnowledgeBuilderConfiguration (configuration): org.drools.compiler.PackageBuilderConfiguration@630cb4a4

>> KnowledgeBuilder (kbuilder):  org.drools.builder.impl.KnowledgeBuilderImpl@239bof9d

>> ResourceFactory.newClassPathResource(spreadsheetFile):  [ClassPathResource path='spreadsheet.xls']

>> ResourceType.DTABLE:  ResourceType = 'Decision Table'

>> DecisionTableConfiguration (config):  org.drools.builder.conf.impl.DecisionTableConfigurationImpl@150ab4ed

>> DecisionTableConfiguration (config.getInputType()):  XLS









所以我决定从drools 5.5.0升级到7.5.0并使用kie-api / kie-ci;我不得不做一些重构,因为现在流口水是KIE(知识就是一切)的一部分,请看下面的代码:







So I decided to upgrade from drools 5.5.0 to 7.5.0 and use kie-api/kie-ci; I had to do some refactoring because now drools is part of the KIE (Knowledge Is Everything) umbrella, see the code below:

KieServices ks = KieServices.Factory.get();
KieContainer kc = ks.getKieClasspathContainer();
KieSession ks = kc.newKieSession("ksession-dtables");  //stateful session
FactHandle fh = ks.insert(fact);
ks.fireAllRules();





....



包裹和规则被加载到知识库中,但只有第一个规则启动然后停止,我是否需要升级我的决策表(电子表格)才能使用Java 8工作drools 7.5.0?







欢迎任何建议。







谢谢!!



我的尝试:



弄清楚我是否需​​要修改我的决策表(电子表格)并调试代码以找到罪魁祸首。



....

The packages and rules are loaded into the Knowledge Base but only the first rules fire up and then it stops, do I need to upgrade my decision table (spreadsheet) in order to work for drools 7.5.0 with Java 8?



Any suggestions are welcome.



Thanks!!

What I have tried:

Figuring out if I need to modify my decision table (spreadsheet) and debug the code to find the culprit.

推荐答案

我用过drools 6.5.0,一切似乎都正常。似乎drools 7.0.0及更高版本使用不同的决策表(电子表格)格式。
I used drools 6.5.0 and everything seems to work properly. It seems like drools 7.0.0 and higher use a different decision table (spreadsheet) format.


这篇关于Java 8,drools 5.x和drools 7.x的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆