Hi everyone,
I’m working on a Spring Boot application with an embedded Camunda 7 engine, and my goal is to update a DMN model at runtime via a custom REST call. The flow I aim to implement is as follows:
- I change the DMN rules.
- I deploy the updated DMN file to Camunda.
The problem arises when I test the new rules - no changes seem to be applied in the DMN evaluation. I’ve turned off all caches, tried various queries, but the new rules just don’t seem to work.
Here’s the code I’m using to deploy the updated DMN model:
public void deployUpdatedDmnModel() {
Deployment deployment = repositoryService.createDeployment()
.activateProcessDefinitionsOn(new Date())
.addClasspathResource("dish_test.dmn")
.name("Updated DMN Deployment")
.deploy();
log.info("DMN Model deploy ID: {}", deployment.getId());
}
And here’s how I evaluate the decision table to get a dish by season and guest count:
public String getDishBySeasonAndGuestCount(String season, int guestCount) {
DecisionDefinition latestDecision = repositoryService.createDecisionDefinitionQuery()
.decisionDefinitionKey("dish")
.latestVersion()
.singleResult();
log.info("Id of latest DMN: {}", latestDecision.getId());
log.info("Version of latest DMN: {}", latestDecision.getVersion());
VariableMap variables = Variables.createVariables()
.putValue("season", season)
.putValue("guestCount", guestCount);
return processEngine.getDecisionService()
.evaluateDecisionTableByKeyAndVersion("dish", latestDecision.getVersion(), variables)
.getSingleEntry();
}
For reference, I created the DMN model following the sample provided in the Camunda documentation Create a DMN Decision Table | docs.camunda.org