我正在执行POST,其中包含在kie-server上运行的KIE容器实例的命令列表。 最后一条命令是“ get-objects”命令。
我看到每执行一次发布,kie会话中的对象列表就会增加1个元素。
如何在每次跑步前进行清晰的会话? 是否有必要在KIE Workbench中进行设置或在我的请求中添加一些命令?
这是请求:
{"lookup":"defaultKieSession","commands": [{
"insert": {
"object": {
"java.util.HashMap": {
"lifestage": "CAREERFOCUSED",
"assets": "FROM150KTO300K",
"need": "MORTAGE"
}
},
"out-identifier": "map",
"return-object": "true"
}
},
{
"set-global": {
"identifier": "resultmap",
"out-identifier": "resultmap",
"object": {
"java.util.HashMap" : {}
}
}
},
{
"set-global": {
"identifier": "list",
"out-identifier": "list",
"object": {
"java.util.List" : []
}
}
},
{
"fire-all-rules": {
"max": -1,
"out-identifier":"firedActivations"
}
},
{
"get-global": {
"identifier": "resultmap",
"out-identifier": "resultmap"
}
},
{
"get-global": {
"identifier": "list",
"out-identifier": "list"
}
},
{ "get-objects":{
"out-identifier":"facts"
}
}]
}
这是第一反应
{
"type": "SUCCESS",
"msg": "Container test successfully called.",
"result": {
"execution-results": {
"results": [{
"value": {
"discount": 10,
"singleproduct": "LOAN",
"financialpackage": "CAREERFOCUSED_PACKAGE"
},
"key": "resultmap"
}, {
"value": 3,
"key": "firedActivations"
}, {
"value": [{
"ruleName": "ProductPackageSelection"
}, {
"ruleName": "DiscountLevel2"
}, {
"ruleName": "NeedsAssessmentMortage2"
}
],
"key": "list"
}, {
"value": {
"assets": "FROM150KTO300K",
"need": "MORTAGE",
"lifestage": "CAREERFOCUSED"
},
"key": "map"
}, {
"value": [{
"assets": "FROM150KTO300K",
"need": "MORTAGE",
"lifestage": "CAREERFOCUSED"
}
],
"key": "facts"
}
],
"facts": [{
"value": {
"org.drools.core.common.DefaultFactHandle": {
"external-form": "0:1:402250881:1019704551:1:DEFAULT:NON_TRAIT:java.util.HashMap"
}
},
"key": "map"
}
]
}
}
}
这是相同请求后的第二个响应
{
"type": "SUCCESS",
"msg": "Container test successfully called.",
"result": {
"execution-results": {
"results": [{
"value": {
"discount": 10,
"singleproduct": "LOAN",
"financialpackage": "CAREERFOCUSED_PACKAGE"
},
"key": "resultmap"
}, {
"value": 3,
"key": "firedActivations"
}, {
"value": [{
"ruleName": "ProductPackageSelection"
}, {
"ruleName": "DiscountLevel2"
}, {
"ruleName": "NeedsAssessmentMortage2"
}
],
"key": "list"
}, {
"value": {
"assets": "FROM150KTO300K",
"need": "MORTAGE",
"lifestage": "CAREERFOCUSED"
},
"key": "map"
}, {
"value": [{
"assets": "FROM150KTO300K",
"need": "MORTAGE",
"lifestage": "CAREERFOCUSED"
}, {
"assets": "FROM150KTO300K",
"need": "MORTAGE",
"lifestage": "CAREERFOCUSED"
}
],
"key": "facts"
}
],
"facts": [{
"value": {
"org.drools.core.common.DefaultFactHandle": {
"external-form": "0:2:1394076269:1019704551:2:DEFAULT:NON_TRAIT:java.util.HashMap"
}
},
"key": "map"
}
]
}
}
}
您可以看到在第二响应的对象列表(关键是事实)中,有两个项目(具有相同的值)
感谢所有帮助, 罗伯托