【发布时间】:2021-11-30 17:02:26
【问题描述】:
我有简单的业务流程,在 RestService WorkItem 之前和之后执行规则 BPM Process
我还在设置中定义了 Rest Work Handler 定义。 Rest Work Handler DefinitionInstall Rest Work Item Handler.
使用 Java KIE API 调用 RuleServicesClient 来执行规则和 BPM 流程。
KieServices kieServices = KieServices.Factory.get();
CredentialsProvider credentialsProvider = new EnteredCredentialsProvider(USERNAME, PASSWORD);
KieServicesConfiguration kieServicesConfig = KieServicesFactory.newRestConfiguration(KIE_SERVER_URL, credentialsProvider);
// Set the Marshaling Format to JSON. Other options are JAXB and XSTREAM
kieServicesConfig.setMarshallingFormat(MarshallingFormat.JSON);
KieServicesClient kieServicesClient = KieServicesFactory.newKieServicesClient(kieServicesConfig);
// Retrieve the RuleServices Client.
RuleServicesClient rulesClient = kieServicesClient.getServicesClient(RuleServicesClient.class);
List<Command<?>> commands = new ArrayList<>();
KieCommands commandFactory = kieServices.getCommands();
commands.add(commandFactory.newInsert(new RestFlowRequest(\"Sample\"), \"SampleRequest\"));
commands.add(commandFactory.newStartProcess(\"RuleFlowSample.DecisionRestBPM\"));
//commands.add(commandFactory.newFireAllRules(\"numberOfFiredRules\"));
//ProcessServicesClient processService
// = kieServicesClient.getServicesClient(ProcessServicesClient.class);
//processService.startProcess(CONTAINER_ID,\"RuleFlowSample.DecisionRestBPM\");
BatchExecutionCommand batchExecutionCommand = commandFactory.newBatchExecution(commands);
ServiceResponse<ExecutionResults> response = rulesClient.executeCommandsWithResults(CONTAINER_ID, batchExecutionCommand);
它无法执行 Rest Service 任务并出现以下错误 Error Thrown By KIE Server
如果更改代码以使用 ProcessServicesClient 启动流程,则业务流程执行没有任何问题,但规则不执行。