Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Drools kie java客户端对象在规则中修改,未得到结果_Java_Drools_Kie Server - Fatal编程技术网

Drools kie java客户端对象在规则中修改,未得到结果

Drools kie java客户端对象在规则中修改,未得到结果,java,drools,kie-server,Java,Drools,Kie Server,我使用的是kie服务器7.0和kie java客户端7.0。 我在工作台上写了一条简单的规则:- rule "Hello World" when a:CartDetails(minPurchaseAmt==10000) then a.setMinPurchaseAmt(20.0f); System.out.println( "Test rule executed success"); end 这是我的客户代码:- Command<?> insert = co

我使用的是kie服务器7.0和kie java客户端7.0。 我在工作台上写了一条简单的规则:-

rule "Hello World"
when
    a:CartDetails(minPurchaseAmt==10000)
then
    a.setMinPurchaseAmt(20.0f);
    System.out.println( "Test rule executed success");
end
这是我的客户代码:-

Command<?> insert = commandsFactory.newInsert(fact,     "CartDetails",true,"DEFAULT");
Command<?> fireAllRules = commandsFactory.newFireAllRules();
Command<?> factObjects = commandsFactory.newGetObjects();
Command<?> batchCommand = commandsFactory.newBatchExecution(Arrays.asList(insert,fireAllRules,factObjects));
ServiceResponse<ExecutionResults> executeResponse = rulesClient.executeCommandsWithResults("couponengine_1.0", batchCommand);
Command insert=commandsFactory.newInsert(事实,“cartdestails”,true,“DEFAULT”);
Command fireAllRules=commandsFactory.newFireAllRules();
Command factObjects=commandsFactory.newGetObjects();
Command batchCommand=commandsFactory.newBatchExecution(Arrays.asList(insert、fireAllRules、factObjects));
ServiceResponse ExecuterResponse=rulesClient.executeCommandsWithResults(“couponengine_1.0”,batchCommand);
我得到“成功”的回应,但不是更新的对象。(当我在规则的“then”部分调用setMinPurchaseAmt()时)


请告知您是否需要更多输入。

您必须使用更新功能来指示drools引擎更新事实值。在规则的后一部分中添加更新(a)。尝试使用这种方法并共享结果

您必须使用更新功能来指示drools引擎更新事实值。在规则的后一部分中添加更新(a)。尝试此方法并共享结果

找到了解决方法。这个问题不在规则部分。它在模型中。我在规则服务器上定义的模型(日期对象)与我从客户端发送的模型(日期对象)不匹配。这就是为什么规则没有被解雇。找到了解决方法。这个问题不在规则部分。它在模型中。我在规则服务器上定义的模型(日期对象)与我从客户端发送的模型(日期对象)不匹配。这就是为什么rule不会被解雇。