I have a project in business central with 8 dmn models. Is there any way to trigger all the 8 models from java code in a single api call, like we triggering many drl files in single api call?
2 Answers
DRL files belong to a defined Knowledge base/KieBase, and you create a KieSession from a given KieBase. That is the reason why when inserting Facts/Events into a KieSession and firing, several rules from the several DRLs are evaluated, as they belong to a specified Knowledge base.
DMN models instead are not identified by a Knowledge base, but are identified by their { namespace, name }
coordinates.
There is no single command to execute a series of DMN models ootb, especially since the required InputData(s) might vary between each model.
eg: a given DMN model requires InputData Name
and Age
, while another DMN model requires InputData Customer
and Product
.
You can however orchestrate a series of KieCommand
(s) in a batch which would evaluate each DMN model iteratively based on your requirement, or chain the calls from the Kie Server Client (Java API) analogously.

- 2,178
- 2
- 15
- 23
Usually when i test/verify the output from dmn model using this:
HashMap<String, Object> input = new HashMap<String, Object>();
input.put("variable1", value1);
input.put("variable2", value2);
List<DMNDecisionResult> decision = jbpmDmnService.getDmnDecision(input, containerId,
dmnNamespace, dmnModel);
for (DMNDecisionResult dr : decision) {
log.info("Decision: {}, Result: {}", dr.getDecisionName(), dr.getResult());
}
If triggering multiple dmn then will be calling this method jbpmDmnService.getDmnDecision(input, containerId, dmnNamespace, dmnModel); multiple times based on the dmn's necessary inputs, container, namespace and model
DMNDecisionResult from package org.kie.dmn.api.core
the getDmnDecision method content:
KieServicesConfiguration conf = KieServicesFactory.newRestConfiguration(jbpmUrl, initUsername, initPassword);
KieServicesClient kieServicesClient = KieServicesFactory.newKieServicesClient(conf);
log.info("URL [{}], Namespace[{}], Model[{}]",jbpmUrl,namespace,model);
DMNServicesClient dmnClient = kieServicesClient.getServicesClient(DMNServicesClient.class);
DMNContext dmnContext = dmnClient.newContext();
for (Map.Entry<String, Object> con: context.entrySet()) {
dmnContext.set(con.getKey(), con.getValue());
}
ServiceResponse<DMNResult> serverResp = dmnClient.evaluateAll(containerId, namespace, model, dmnContext);
DMNResult dmnResult = serverResp.getResult();

- 1
- 1