Drools: how to retrieve the fact in response from Kie Execution Server?

送分小仙女□ 提交于 2019-12-08 10:20:34

问题


I am using Kie Execution Server 6.2 final and I have a simple rule file deployed on the server and I am accessing it through rest api. When I try to execute the rules, everything goes well, but I do not get newly inserted fact in the response.

Here is my drl file

rule "Odd Rule"
dialect "mvel" 
when
    testRecord : TestRecord((integerValue & 1) == 1 && integerValue != 0  , testId: testRecordId , intValue :integerValue )
then
    System.out.println( "Odd Rule- Test ID "+ testId );
    TestResult $testResult = new TestResult();
    $testResult.setTestrecordId(testId);
    $testResult.setDescription("Odd Rule");
    $testResult.setValueInteger(intValue * (-10));
    insert($testResult);

   end

and post request on server

 <batch-execution>
 <insert out-identifier="TestReord">
 <com.drools.poc.TestRecord>
 <integerValue>10</integerValue>
 <testRecordId>10</testRecordId>
 </com.drools.poc.TestRecord>
 </insert>

response from server

<response type="SUCCESS" msg="Container Container1 successfully called.">
    <results><execution-results>
    <result identifier="TestReord">
    <com.drools.poc.TestRecord>
    <integerValue>10</integerValue>
    <testRecordId>10</testRecordId>
    </com.drools.poc.TestRecord>
    </result>
    <fact-handle identifier="TestReord" external form="0:29:1697585638:1697585638:29:DEFAULT:NON_TRAIT"/>
    </execution-results></results>
</response> 

来源:https://stackoverflow.com/questions/31495266/drools-how-to-retrieve-the-fact-in-response-from-kie-execution-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!