An example spring-boot project that dynamically generates a dmn file via a REST endpoint.
To start the application run:
mvn clean package spring-boot:run
The POST endpoint http://localhost:8085/generate_and_deploy generates and deploys a dmn file in a running Camunda process engine.
The dmn rules are generated on the fly using external variables. This can be enhanced to obtain the data fetched from a database.
To test whether the rules are working correctly, hit the POST endpoint http://localhost:8080/run_decisions/dynamic_dmn
Sample request body: {
"input1": 30,
"input2": 1,
"input3": "abc"
}
Response:
[ { "output": "success" } ]
Note: Lombok is used in the project. Hence Lombok plugin will need to be installed in your IDE if you need to get rid of any compilation errors in your IDE.