首页 > 解决方案 > 如何在 Drools 规则引擎中使用 Rest Service API 调用打开实时查询

问题描述

我正在使用 RuleServicesClient 在单独托管的 KIE 服务器上执行规则。

一般来说,我使用以下代码来触发规则 -

RuleServicesClient ruleClient = kieServicesClient.getServicesClient(RuleServicesClient.class);
List<Command<?>> cmds = new ArrayList<Command<?>>();
KieCommands commands = KieServices.Factory.get().getCommands();
cmds.add(commands.newInsert(test, "test1"));

BatchExecutionCommand batchExecutionCommand = CommandFactory.newBatchExecution(cmds, "sesion_1");       
ServiceResponse<ExecutionResults> response = ruleClient.executeCommandsWithResults(containerId, batchExecutionCommand);

现在我需要通过在参数中传递事件侦听器来打开实时查询,但找不到任何关于如何使用 RuleServicesClient 实现此目的的示例。

我能够执行如下简单查询,但不确定如何为实时查询执行此操作。

cmds.add(commands.newQuery("QueryResult","test_query"));

对此的任何帮助将不胜感激。

谢谢

标签: droolskie

解决方案


推荐阅读