1

我正在使用 kie-server 7.0 和 kie-java-client 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);

我得到“成功”作为响应,但没有得到更新的对象。(因为我在规则的“那么”部分调用 setMinPurchaseAmt())

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

4

1 回答 1

0

您必须使用更新功能来指示流口水引擎更新事实值。在规则的 then 部分添加 update(a)。尝试这种方法并分享结果

于 2017-06-24T04:25:29.037 回答