I have recently migrated from a Drools application to a Kogito application, and I'm facing challenges in updating/creating rules on a deployed application. In the Drools application, I used to create rules dynamically from another app, pass them to the drools application, insert them into the KieFileSystem, and create a new KieSession with the updated/new rules.
However, I understand that this is not the recommended aproach and Kogito apps no longer utilize kjars for rule management. So, I'm seeking guidance on the best approach to update rules regularly in a deployed Kogito application.
Specifically, I would like to know:
Any insights, examples, or references to relevant documentation would be greatly appreciated. Thank you!
Kogito was designed to be Cloud ready. And thus benefits from Orchestrators to manage the application. Which means that the best way to update a rule is to rebuild and deploy the application.
Build and Deploy I would suggest to store the rules in a repository, have a hook on that repository which would trigger a CI to build your application. Then deploy it where you need.
Switch to your new rules application With a cloud orchestrator like Kubernetes, you would just need to create a new image containing your application and update the deployment. Kubernetes would take care of starting the new application and once started, kill the old one. If you need a more fine tuned switch, you can look at frameworks like Istio.
If you are on bare-metal, you could use a gateway application as entry point to your rules apps, start the new application and make the switch on the gateway once the new application is running.